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
Why do we use encapsulation in oops?
What are the 4 pillars of oop?
What do you mean by Encapsulation?
Are polymorphisms mutations?
Why is abstraction used?
What is static in oop?
What is difference between multiple inheritance and multilevel inheritance?
Why is polymorphism used?
Is this job good for future? can do this job post grduate student?
What does enum stand for?
Can private class be inherited?
What is encapsulation example?
What is overriding vs overloading?
What is stream in oop?
Why is static class not inherited?