S
SpotNet
Hello NewsGroup,
I have a base class and six classes that inherit from this base class. All
members in the base class are used in it's extended classes except, in one
of the extended class one member in the base class is not required. Is it
possible to mark a method in the extended class such that it does not appear
in that particular extended class?
I know you can use the 'new' keyword and redefine the method with a
'private' attribute as a work around, but is there a way to make the method
truely hidden? Something similar (I know it's not the same) like VB 6, where
if a method was defined like;
[_AMemberName] where [_ ] would make a method hidden.
===================================================
Eg;
public class TheBase
{
public TheBase() {}
protected virtual Int32 EveryClassUsesThisMethod()
{ return 0;}
protected virtual Int32 OneClassDoesntUseThisMethod() //But all the
others do....!
{ return 0;}
}
public class OneClassExtension: TheBase
{
public OneClassExtension(): base(){}
protected overide Int32 EveryClassUsesThisMethod()
{return base.EveryClassUsesThisMethod();}
private new void OneClassDoesntUseThisMethod(){} //<---A different or
better way of hiding members?
}
Thanks NewsGroup.
Regards,
- SpotNet
I have a base class and six classes that inherit from this base class. All
members in the base class are used in it's extended classes except, in one
of the extended class one member in the base class is not required. Is it
possible to mark a method in the extended class such that it does not appear
in that particular extended class?
I know you can use the 'new' keyword and redefine the method with a
'private' attribute as a work around, but is there a way to make the method
truely hidden? Something similar (I know it's not the same) like VB 6, where
if a method was defined like;
[_AMemberName] where [_ ] would make a method hidden.
===================================================
Eg;
public class TheBase
{
public TheBase() {}
protected virtual Int32 EveryClassUsesThisMethod()
{ return 0;}
protected virtual Int32 OneClassDoesntUseThisMethod() //But all the
others do....!
{ return 0;}
}
public class OneClassExtension: TheBase
{
public OneClassExtension(): base(){}
protected overide Int32 EveryClassUsesThisMethod()
{return base.EveryClassUsesThisMethod();}
private new void OneClassDoesntUseThisMethod(){} //<---A different or
better way of hiding members?
}
Thanks NewsGroup.
Regards,
- SpotNet