P
psandler70
All,
This might be a stupid question.
When defining an interface, is it possible to force the class that
implements it to support a property/method with the same name, but not
force a specific type?
So the interface would specify:
object myValue
{
get;
set;
}
and the implementing class would have:
public int myValue
{
get {return _myValue;}
set { _myValue = value;}
}
The above is a simple example. What I'm really trying to do is have an
interface with a List<object>, and implementing classes that use
List<myTypeA>, List<myTypeB>, etc.
Would this defeat the purpose of having an interface to begin with?
Thanks for any insight,
Phil
This might be a stupid question.
When defining an interface, is it possible to force the class that
implements it to support a property/method with the same name, but not
force a specific type?
So the interface would specify:
object myValue
{
get;
set;
}
and the implementing class would have:
public int myValue
{
get {return _myValue;}
set { _myValue = value;}
}
The above is a simple example. What I'm really trying to do is have an
interface with a List<object>, and implementing classes that use
List<myTypeA>, List<myTypeB>, etc.
Would this defeat the purpose of having an interface to begin with?
Thanks for any insight,
Phil