ADO.NET Question: Download Questions PDF
Why ca not we use Multiple inheritance and garbage collector paralelly in .net?
![ADO.NET Interview Answer ADO.NET Interview Question](https://globalguideline.com/public/images/interview/20.png)
Answer:
.net doesn't support the mutiple inheritance, perhaps you may talk about multi-level inheritance.
In the later case, if a class is inherited from another class, at the time of creating instance, it will obviously give a call to its base class constructor (ie bottom - top approach). Like wise the constructor execution is takes place in top down approach (ie. base class constructor is executed and the derived class constructor is executed).
So for GC, it will collect only when an object does not have any reference. As we see previously, the derived is constructed based on base class. There is a reference is set to be. Obviously GC cannot be collected.
In the later case, if a class is inherited from another class, at the time of creating instance, it will obviously give a call to its base class constructor (ie bottom - top approach). Like wise the constructor execution is takes place in top down approach (ie. base class constructor is executed and the derived class constructor is executed).
So for GC, it will collect only when an object does not have any reference. As we see previously, the derived is constructed based on base class. There is a reference is set to be. Obviously GC cannot be collected.
Download ADO.NET Interview Questions And Answers
PDF
Previous Question | Next Question |
Difference between SqlCommand and SqlCommandBuilder? | How to find the given query is optimised one or not? |