Re: Modifier mixture
- From: "AD" <adriaandavel@xxxxxxxxxxx>
- Date: 11 Dec 2006 20:49:06 -0800
Jon wrote:
AD <adriaandavel@xxxxxxxxxxx> wrote:
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?
You can't.
What exactly are you trying to achieve? One pattern is to have one
concrete method, and an abstract one which is called by the concrete
one.
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Hi Jon, thanks for the post
What I'm trying to do is to use a class as an abstract class, but still
be able to use the class as a normal class. This is sounding like a
virtual class, but with the virtual class overrides are optional.
My current design is that my base class carries the "generic"
functionality of most applications developed by our company, so when it
is inherited it exposes that functionality to all consumer classes. Now
I would also like my base class to enforce certain functions in all
consumer classes (for example a function called "Install" that will
create all SQL Stored procs used by the module) to improve consistancy
across classes and open up some reflection possibilities.
The only way I see this happening is creating a copy of my base class
as a true abstract class and consumer inheriting that, but that would
cause code duplication that I'm trying to avoid.
Does this make any sense?
.
- Follow-Ups:
- Re: Modifier mixture
- From: Larry Lard
- Re: Modifier mixture
- From: Jon Skeet [C# MVP]
- Re: Modifier mixture
- References:
- Modifier mixture
- From: AD
- Re: Modifier mixture
- From: Jon Skeet [C# MVP]
- Modifier mixture
- Prev by Date: Re: How to limit input
- Next by Date: Re: server client
- Previous by thread: Re: Modifier mixture
- Next by thread: Re: Modifier mixture
- Index(es):
Relevant Pages
|