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 / ankur sehgal
public class TrialClass
{
protected int i, j;
public TrialClass(int one, int two)
{
i = one;
j = two;
}
public TrialClass(int joo)
{
}
public int squareArea()
{
int side1;
int side2;
side1 = i;
side2 = j;
return side1 * side2;
}
}
public class myDerivedClass : TrialClass
{
int rd;
int dr;
public myDerivedClass(int Age, int ages):base(Age)
{
rd = ages;
dr = Age;
}
}
Try making the base class single parameterized constructor
private.You will get your answer.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
when to use 'mutable' keyword and when to use 'const cast' in c++
Why do pointers exist?
What is oops and its features?
Why do while loop is used?
explain sub-type and sub class? atleast u have differ it into 4 points?
What is destructor example?
Why can't we have instance(stack) of a class as a member of the same class like eg.Class A{A obj;} as we can have self refential pointer
Can a varargs method be overloaded?
write a programe to calculate the simple intrest and compund intrest using by function overlading
Will I be able to get a picture in D drive to the c++ program? If so, help me out?
Which is not an object oriented programming language?
why reinterpret cast is considered dangerous?
What is cohesion in oop?
What is static modifier?