A
AD
Hi,
I have a base class that is inherited often, and I am struggeling to
chose the correct access modifiers.
What I am trying to do is to force all inherited classes to have a
function of the same name as one of the functions in base class (like
an abstract function), but I would also like to add a body to the
function in the base class (like a public/private/protected function),
how would I go about it?
public class BaseClass
{
public BaseClass() {}
public/abstract bool SomeFunction(){return false;} //This is where
the problem lies
}
public class DerivedClass : BaseClass
{
public DerivedClass():base() {}
public bool SomeFunction(){return false;}
}
I have a base class that is inherited often, and I am struggeling to
chose the correct access modifiers.
What I am trying to do is to force all inherited classes to have a
function of the same name as one of the functions in base class (like
an abstract function), but I would also like to add a body to the
function in the base class (like a public/private/protected function),
how would I go about it?
public class BaseClass
{
public BaseClass() {}
public/abstract bool SomeFunction(){return false;} //This is where
the problem lies
}
public class DerivedClass : BaseClass
{
public DerivedClass():base() {}
public bool SomeFunction(){return false;}
}