Hi
What is the syntax to inherit from a class in C#?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Aug 29, 2012, 9:25 AM
Notice also that in C# a class can only inherit from one other class. If you don't specify a parent class, then it implicitly inherits from System.Object which sits at the top of the inheritance hierarchy.
If you mark a class as 'sealed', then it cannot be inherited from.
Akkiraju IvaturiPosted Aug 29, 2012, 9:16 AM
public class Manager:Employee
{
//Employee fields, properties, methods and events are inherited
//New Manager fields, properties, methods and events go here..
}
When a class declares a base class it inherits all the members of the class except constructors.
VulpesPosted Aug 29, 2012, 8:06 AM
class Derived : Parent
{
// code
}