Inheritance question

  • Thread starter Thread starter Johan Karlsson
  • Start date Start date
J

Johan Karlsson

Hi!

I know this might defeat the purpose of inheritance, but due to a design
restriction I need to know if this is possible.

When inheriting a class, is is possible to "remove" methods or properties
from the baseclass? Example: If class A has the property Name and class B
inherits from class A. Can I somehow make the property Name "go away"?

Or is basic redesign what this takes to model a more correct picture?

Thanks

Johan
 
Johan,
Can I somehow make the property Name "go away"?

No. You can sort of hide it by shadowing it with a new private member
with the same name. But the base member is still there and trivial to
access.



Mattias
 
Back
Top