[WEBINAR] Application Acceleration: Faster Performance for End Users

Derived Class

Definition - What does Derived Class mean?

A derived class, in the context of C#, is a class created, or derived from another existing class. The existing class from which the derived class gets created through inheritance is known as base or super class.

While inheriting from base class, the derived class implicitly inherits all the members (except constructors and destructors) which it reuses, extends and modifies the behavior of the base class. The derived class overrides the properties and methods of the base class so that it represents the specialized version of base class. C# provides ability to override and hide methods of base class in derived class which makes both classes to evolve freely and maintain binary compatibility.

Techopedia explains Derived Class

Following are some of the features of derived classes in C#:

  • As in Java and unlike C++, a derived class cannot have more than one base class but can be derived from more than one interface. However, it inherits all the members of its parent base classes declared in its inheritance hierarchy, due to transitive nature of inheritance
  • Access modifiers used in the declaration statement of derived class specify the permissions to use members of its base class
  • Code in the constructor of a derived class which is executed during its creation, will be executed only after executing constructor of its base class
  • Derived class has to use the modifier, ‘override’ to declare the virtual method (declared in its base class with ‘virtual’ keyword) that has to be overridden. Only instance methods and properties can be overridden
  • Derived class can have new method that hides the virtual method declared in base (with similar signature) by using the keyword, ‘new’. To access the method in base class from derived class, ‘base’ keyword can be used
  • A class can prevent derivation by declaring it as ‘sealed’ and cannot be used as base class
  • A derived class with base class as an abstract class can be instantiated if the derived class is not declared abstract and derived class has the implementation for all abstract methods declared in the base class
This definition was written in the context of .NET

Techopedia Deals

Connect with us

Techopedia on Linkedin
Techopedia on Linkedin
"Techopedia" on Twitter

Sign up for Techopedia's Free Newsletter!

Email Newsletter

Join thousands of others with our weekly newsletter

Free Whitepaper: The Path to Hybrid Cloud
Free Whitepaper: The Path to Hybrid Cloud:
The Path to Hybrid Cloud: Intelligent Bursting To Amazon Web Services & Microsoft Azure
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.