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
What is the diamond problem in inheritance?
What is polymorphism what is it for and how is it used?
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 are properties in oop?
Can we have inheritance without polymorphism?
What is class and example?
What is multilevel inheritance?
Following are the class specifications: class {int a}; class {int b}; Using friend funtion,calculate the max of two objects and display it.
What does sksksk mean in text slang?
Is abstract thinking intelligence?
Why multiple inheritance is not allowed?
Why do we use polymorphism in oops?
What is polymorphism oop?
What does <> mean pseudocode?
What is static modifier?