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??
Orlando SalcidoPosted May 3, 2007, 8:01 PM
Mike GoldPosted May 3, 2007, 7:19 PM
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());