What are the advantages of inheritance?
Answer Posted / hamid
Features or Advantages of Inheritance:
---Reusability:
Inheritance helps the code to be reused in many
situations. The base class is defined and once it is
compiled, it need not be reworked. Using the concept of
inheritance, the programmer can create as many derived
classes from the base class as needed while adding specific
features to each derived class as needed.
---Saves Time and Effort:
The above concept of reusability achieved by inheritance
saves the programmer time and effort. Since the main code
written can be reused in various situations as needed.
---Increases Program Structure which results in greater
reliability.
www.hamidraza.page.tl
Is This Answer Correct ? | 121 Yes | 12 No |
Post New Answer View All Answers
What is object in oop with example?
What is difference between pop and oop?
Why we use classes in oop?
What is encapsulation c#?
Which is not an object oriented programming language?
What are main features of oop?
Why do pointers exist?
Question In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest. Question Submitted By :: Sunil Kumar I also faced this Question!! Rank Answer Posted By Re: In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest. Answer # 1 use copy constructors 0 Shanthila There is something to be taken care in destructor, in copy constructor, suppose the memory is assigned to the embedded member object pointer with the parameter passed value, but if some other objects of different class also are pointing to this memory, then if some one deletes the object then this class member pointer object will become dangling, or if the object is not deleted properly then there will be memory leak. Please suggest the design change required to handle or avoid this situation
Why oops is important?
How to hide the base class functionality in Inheritance?
write a program to find 2^n+1 ?
How do you define a class in oop?
Advantage and disadvantage of routing in telecom sector
Why do we need polymorphism in c#?
what is the drawback of classical methods in oops?