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
How do you use inheritance in unity?
What is the real time example of encapsulation?
Can private class be inherited?
What is the benefit of oop?
given a set based questions and 5 questions based on it next data sufficiciency questions 2 and 2/3 english sentence completion with options very easy and 2 synononmys paragraph with 10 questions 10 minutes replace =,-,*,% with -,%,+,* type questions 5 3 questions lik following itssickhere itssickthere itssickhere istsickhere which is nt alike the others very easy
What is polymorphism and example?
INSTANCE FIELDS DECLARED private ARE ACCESSIBLE BY THE METHODS ONLY.CAN WE CHANGE THE private FIELD OF AN OBJECT IN A METHOD OF SOME OTHER OBJECT OF THE SAME CLASS?
What is multilevel inheritance explain with example?
What is encapsulation and abstraction? How are they implemented in C++?
What is the significance of classes in oop?
Which language is not a true object oriented programming language?
Can you inherit a private class?
c++ program to swap the objects of two different classes
What is abstraction example?
What is the diamond problem in inheritance?