Is it possible for two classes to inherit from each other

Questions by mahmoud taha

Showing Answers 1 - 4 of 4 Answers

shivaramag

  • Aug 4th, 2011
 

No it is not possible. compile time error is thrown

Circular base class dependency involving 'x' and 'y'

x & y are classes derived from each other.

  Was this answer useful?  Yes

Praveen

  • Jan 16th, 2012
 

No, it is not possible. One of the reasons is stated below.

In inheritance, if we create an object to child class, the base class constructor is by default called in derived class constructor as the first statement. Since there is cyclic dependency it will go into infinite loop.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions