Saturday, July 07, 2007

FAQ on Inheritance in .Net

FAQ on Inheritance in .Net

What is Inheritance?
The process of sub-classing a class to extend its functionality is called Inheritance.
It provides idea of reusability.

What is Order of Constructor execution in Inheritance?
constructors are called in the order from the top to the bottom (parent to child class) in inheritance hierarchy.

What is Order of Destructor execution in Inheritance?
The destructors are called in the reverse order, i.e., from the bottom to the top (child to parent class) in the inheritance hierarchy.

What are Sealed Classes in C#?
The sealed modifier is used to prevent derivation from a class. A compile-time error occurs if a sealed class is specified as the base class of another class. (A sealed class cannot also be an abstract class)

Does C# supports Multiple Inheritance?
Multiple inheritance of classes is not allowed in C#.

How do I achieve Multiple Inheritance in C#?
In C# you can implements more than one interface, thus multiple inheritance is achieved through interface.

Which is the ultimate base class for all the classes in .Net?
Sytem.Object, The Object class defined in the System namespace is implicitly the ultimate base class of all the classes in C# (and the .NET framework)

Does structure in C# supports inheritance?
Structures (struct) in C# does not support inheritance, it can only implements interfaces.

No comments:

Most Recent Post

Community Updates

Subscribe Blog via Email

Enter your email address:



Disclaimers:We have tried hard to provide accurate information, as a user, you agree that you bear sole responsibility for your own decisions to use any programs, documents, source code, tips, articles or any other information provided on this Blog.
Page copy protected against web site content infringement by Copyscape