C# 4.0 .NET 4.5 Silverlight 5 It seems weird that I cant find the solution so need some help please.
I have base class Base and derived class Child : Base. I have also h
If Foo
: Bar
, that doesn't mean that Some
: Some
. There are two ways of doing what you want. The first is to make the base-type generic such that:
Base where T : EntityObject {
protected Helper helper;
}
Child : Base {...}
The second is to use a non-generic interface at the base-type, i.e. have
Base {
protected IHelper helper;
}
Child : Base {...}
where in the latter case, Helper
, for some non-generic IHelper
to-be-defined.
As a side-note, you might find it easier to pass the value down in the constructor rather than using a protected
field.