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 encapsulation in oop?
What is abstraction in oop with example?
What does I oop mean?
Is enum a class?
What is the difference between abstraction and polymorphism?
What is advantage of inheritance?
What is the fundamental idea of oop?
What is encapsulation in simple terms?
Is data hiding and abstraction same?
What is coupling in oops?
Can an interface inherit a class?
What is object-oriented programming? Webopedia definition
What are the data types in oop?
What is and I oop mean?
What is oops and its features?