T
Tony Johansson
Hello experts!
My question is what advantage and disadvantage have public inheritance.
The answer that I have to this is that sometimes it is an advantage to let a
client have access to everything
declared in the public section of the derived class and the base class and
sometimed it is an disadvantage.
Another important advantage is that wherever you can use an object of base
class you can also use an object of it's derived class which result to using
polymorfism.
Sometimes it's a disadvantage to have the client be able to access everyting
in the public section.
If you use public inheritace and you want to use the methods in the
implementation it's not a good idea
because the client can access them.
Have you any additional advantage or disadvantage to add to those that I
have mentioned.
Many thnaks
//Tony
My question is what advantage and disadvantage have public inheritance.
The answer that I have to this is that sometimes it is an advantage to let a
client have access to everything
declared in the public section of the derived class and the base class and
sometimed it is an disadvantage.
Another important advantage is that wherever you can use an object of base
class you can also use an object of it's derived class which result to using
polymorfism.
Sometimes it's a disadvantage to have the client be able to access everyting
in the public section.
If you use public inheritace and you want to use the methods in the
implementation it's not a good idea
because the client can access them.
Have you any additional advantage or disadvantage to add to those that I
have mentioned.
Many thnaks
//Tony