Constructors in inheritance
I have class CReader that inherits StreamReader. When i try to assign Stream via
[code]
CReader(NetworkStream.GetStream());
[/code]
I get 'No overload for CReader takes 1 arguments'
This works if I use it in plain old StreamReader instead of CReader.
I guess I need a custom constructor.... but how??
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Mike GoldRank #50 · 30.6K pointsPosted May 3, 2007, 3:19 PM EDT
using System; using System.Collections.Generic; using System.IO; using System.Text; namespace CustomStreamReader { class CustomStreamReader : StreamReader { public CustomStreamReader(Stream fs) : base(fs) { } } }And you should call it as follows:
CustomStreamReader cr = new CustomStreamReader(NetworkStream.GetStream());
Orlando Salcido12 pointsPosted May 3, 2007, 4:01 PM EDT