what is the difference between containership and inheritence?

Answer Posted / sandeep choudhary

inheritance is the ability for a class to inherit of
properties and the behavior from a parent class by extending it.

while containership is the ability of a class to contain the
another objects as member data.

if a class is extended, it inherits all the public and
protected properties and the behaviors and those behavior
may be overridden by the sub class.but if a class is
contained in another, container class does not have the
ability to add and modify of contained.

Is This Answer Correct ?    47 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are the ways in which a constructors can be called?

1573


What is polymorphism what is it for and how is it used?

570


How do you explain polymorphism?

582


How to handle exception in c++, For example in a functions i am assigning memory to some variables and also in next instructions in am dividing one variable also. If this functions generates a error while allocating memory to those variable and also while dividing the variable if i divide by zero then catch block how it will identify that this error has cone from perticular instruction

1650


What is object in oops?

607






What is object in oop?

673


Will I be able to get a picture in D drive to the c++ program? If so, help me out?

1651


What is the point of oop?

644


Give an example where we have to specifically use C programming language and C++ programming language cannot be used?

1139


Why is static class not inherited?

591


Why is abstraction needed?

561


What does and I oop and sksksk mean?

645


Why do we use class in oops?

549


What does <> mean pseudocode?

618


What is the benefit of oop?

566