When a private constructer is being inherited from one
class to another class and when the object is instantiated
is the space reserved for this private variable in the
memory??

Answer Posted / sanjay makwana, puna

Private Constructor is not inherited.
When private member varible is not inherited but the size is
occupid in dervied class object.

e.g.
#include <iostream.h>
class A
{
int x;
int y;
};

class B : private A
{
};

int main()
{
cout << sizeof(B);
}

output :
8

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is polymorphism in oops with example?

525


What is the difference between inheritance and polymorphism?

585


What are the benefits of interface?

577


Can you inherit a private class?

631


how to get the oracle certification? send me the answer

1668






What is polymorphism and its types?

591


What does and I oop and sksksk mean?

648


What is this pointer in oop?

551


what is difference between class template and template class?

2157


write a code for this:trailer recordId contains a value other than 99, then the file must error with the reason ‘Invalid RECORD_ID’(User Defined Exception).

1636


Which method cannot be overridden?

574


c++ program to swap the objects of two different classes

1759


Why do we use oops?

589


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

572


What are the 5 oop principles?

595