So, let me see if I understand your question.
You want the client code to be able to do either of these:
BaseClass b = new BaseClass();
b.Method1(a, b);
b.Method2(a);
Derivedclass1 d1 = new Derivedclass1();
d1.Method1(a, b);
d1.Method2(a);
Derivedclass2 d2 = new Derivedclass2();
d2.Method1(a, b);
But, you don't want to be able to do this?
d2.Method2(a);
If that is the case, you can't do it because Method2 is part of the
class (to my knowledge). You could however do this:
Derivedclass2 : Baseclass
{
public override Method2(a)
{
throw new System.NotImplementedException();
}
}
That would atleast throw an exception if the client tried to call it.
However, I'd consider revising your design if you feel that you need to do this.
HTH.
> On 1/27/06, Sharon <[EMAIL PROTECTED]> wrote:
> > Hi All,
> > This is the format of classes I Have.
> >
> > BaseClass
> > {
> > public Method1(a,b)
> > public Method2(a)
> > }
> >
> > Derivedclass1 : Baseclass
> > {
> > }
> >
> > Derivedclass2 : Baseclass
> > {
> > }
> >
> > I want Derivedclass2 not to use the method2 from the base class. In other
> words anyone using Derivedclass2 should not have access to method2. I am
> convinced on my end that it cannot be achieved but I was proved wrong more
> then once, So I am here for second opinions.
--
______________________________
- David Lanouette
- [EMAIL PROTECTED]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNet2/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/