Question on inheritance

  • Thread starter Thread starter J.R
  • Start date Start date
J

J.R

I have class B that inherits class c:
B : C

I have client D the instantiates Class B

D.Obj = new B();

I get:
dll Referenced class 'b.b' has base class or interface 'c.c' defined in an
assembly that is not referenced. You must add a reference to assembly 'c'.

I don't want to expose c to client d only b.

Is there a way I can accomplish this?

Thanks, John.
 
Well if B inherits from C, then B "is some sort of" C, then you are already
assuming that your client needs to know what C is. If B didn't inherit from
C, but had some private code that used C, then you could make a reference to
B without a reference to C.

confusing ?

Imagine you have a base class Food, then you create a class Chocolate that
inherits from Food. Then you give a Chocolate object to someone. If this
person doesn't know what Food is he will not do anything with the chocolate,
just stare at it...

Man, that example really sucked!! LOL!
 
Back
Top