In multiple inheritance , to create sub class object , is
there need to create objects for its superclasses???
in java and c++ both. Actually i have some information that
is , all available members from its superclasses , memory
created in subclass obj , so no need to create object for
its superclasses...???
Thanks in Advance
Answer / abhishek
Hi,
There is no need to create an object of the base class, if you want to create an object of the derived class. It is automatically created internally. When you create an object of the derived class then, the constructor of the base class is called first and then the constructor of the derived class. Hence, depending upon the scope specified by access specifiers, we can directly the use the members of the Base class using the object of the Derived class.
Is This Answer Correct ? | 1 Yes | 0 No |
Why is destructor used?
what is function over loading?
What is deep and shalow copy?
IS IT NECESSARY TO INITIALIZE VARIABLE? WHAT IF THE INSTANCE VARIABLE IS DECLARED final ? IS IT NECESSARY TO INITIALIZE THE final VARIABLE AT THE TIME OF THEIR DECLARATION?
1. Strong name 2. how to prevent a class from being inherited 3. delegates 4. default modifier for interface 5. default modifier for class 6. base class for exception 7. diff bet trigger and view in sql 8. how to exchange values from one page to another page 9. can multiple catch block ll be executed at same time 10. can u store different data types in an array & array list 11. when we ll use trigger 12. try,catch,finally usage
What is property in oops?
Can we call a base class method without creating instance?
What is coupling in oops?
what is the size of an empty class
what is ltti
difine hierarchical inheritance.
c++ program to swap the objects of two different classes