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.
Explain you in much simpler word then technical language ..
Suppose you have a class like below
class A { string Name; string Age; }
now you have coded class A but what if you want to Code a Class that hase Same Functionality as A and Additional functionality too. ???
so will you write the above code again to get same functionality as Class A in class B ..???? of course no !!
in this case inheritance can help you to Import the Functionality of Class A into Class B.. it means it can Extend the Functionality .
Class B:A // Inherit Will Import those two variables in Class B {
//Just add Extra Members that are not In A string Age; string Address;
}
so By Look its Looks that we have added only Two New Variable in Class b but While accesing the Class B We can use 4 Variables that's in class A and Class B too :)
if my answer helps you then check "Do you like this answer" check box :)
Hiren SoniPosted Dec 13, 2009, 9:56 PM
Lalit MPosted Dec 14, 2009, 12:04 AM
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.
Kirtan PatelPosted Dec 13, 2009, 10:02 PM
Suppose you have a class like below
class A
{
string Name;
string Age;
}
now you have coded class A but what if you want to Code a Class that hase Same Functionality as A and Additional functionality too. ???
so will you write the above code again to get same functionality as Class A in class B ..???? of course no !!
in this case inheritance can help you to Import the Functionality of Class A into Class B.. it means it can Extend the Functionality .
Class B:A // Inherit Will Import those two variables in Class B
{
//Just add Extra Members that are not In A
string Age;
string Address;
}
so By Look its Looks that we have added only Two New Variable in Class b but While accesing the Class B We can use 4 Variables that's in class A and Class B too :)
if my answer helps you then check "Do you like this answer" check box :)