GeekInterview.com
Series: Subject: Topic:
Question: 11 of 85

Is it possible for two classes to inherit from each other

Asked by: mahmoud taha | Member Since May-2011 | Asked on: May 8th, 2011

View all questions by mahmoud taha

Showing Answers 1 - 2 of 2 Answers
shivaramag

Answered On : Aug 4th, 2011

View all answers by shivaramag

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.

  
Login to rate this answer.
Praveen

Answered On : 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.

  
Login to rate this answer.

Give your answer:

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

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.