Abstract

Inheritance allows you to define a new class that incorporates and extends an already declared class. You can use an existing class, called the base class, as the basis for a new class, called the derived class. The members of the derived class consist of the following: The members in its own declaration The members of the base class To declare a derived class, you add a class-base specification after the class name. The class-base specification consists of a colon, followed by the name of the class to be used as the base class. The derived class is said to directly inherit from the base class listed. A derived class is said to extend its base class, because it includes the members of the base class plus any additional functionality provided in its own declaration. A derived class cannot delete any of the members it has inherited.

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.