GK SCIENTIST

General Knowledge One Stop Source
Menu
  • Home
  • Social Science
    • History
    • Political Science
    • Geography
  • Science
    • Physics
    • Chemistry
    • Biology
  • Chemistry Notes
  • Mathematics
  • Computer
  • Tutorial MySQL
  • Tutorial Python
  • Java Tutorial
  • English Grammar
  • English Essay
  • Indian Anthropology
  • Philosophy
  • Solved Paper
  • UPSC
  • Current Content
    • Current Affairs
    • RSTV News
    • Yojana and Kurukshetra Gist
  • Donate
  • Contact Us

If you are interested in advertising to our audience, submit the advertising enquiry form.

Advertising Enquiry
Computer

Inheritance in C++

Gk Scientist November 19, 2022 No Comments
Tweet WhatsApp Telegram

Table of Contents

  • Inheritance in C++:
  • Needs and Objective of Inheritance in C++:
  • Types of Inheritance in C++:

Inheritance in C++:

C++, like all object-oriented languages, supports class inheritance. Inheritance may be defined as the capability of one class to inherit properties from an existing (base) class. The new class is referred to as the derived class or child class or subclass. The existing class is called the base class or parent class or superclass. The most important advantage of inheritance in C++ is code reusability. Without redefining the old class, you can add new properties to the derived class, and you even can redefine an inherited class member function.

Needs and Objective of Inheritance in C++:

The major needs and objectives of inheritance are:

(1) The capability to express the inheritance relationship which ensures the closeness with the real-world models.

(2) Inheritance extends the functionality of an existing class.

(3) Inheritance establishes “a kind of” relationship.

(4) Idea of reusability, i.e., the new class can use some of the features of the old class (base class).

(5) Transitive nature of inheritance, i.e., it can be passed on further

(6) The redundancy can be reduced by abstracting a superclass from new subclasses (known as a generalization).

Types of Inheritance in C++:

In C++, any class can be a base class. More than one class can be derived from a single base class and a derived can be a base class to another class or classes. Inheritance may take place in many forms which are described below:

(1) Single Inheritance- In single inheritance, a derived class inherits only from one base class.

Single Inheritance in C - Inheritance in C++

(2) Multiple Inheritance- In multiple inheritance, a derived class inherits from multiple base classes.

Multiple Inheritance IN C - Inheritance in C++

(3) Hierarchical Inheritance- In hierarchical inheritance, many derived classes inherit from a single base class.

Hierarchical Inheritance in C - Inheritance in C++

(5) Multilevel Inheritance- The transitive nature of inheritance is reflected by this form of inheritance. When a derived class inherits from a class that itself inherits from another class, it is known as multilevel inheritance.

Multilevel Inheritance in C - Inheritance in C++

(6) Hybrid Inheritance- When a derived class inherits from multiple base classes and all of its base classes inherit from a single base class, this form of inheritance is known as hybrid inheritance.

Hybrid Inheritance in C - Inheritance in C++

Object-Oriented Programming (OOP)
Computer Software and Hardware
Information and Communication Technology
C++ Data Types
Tokens in C++
Install MySQL on Windows
Inheritance (object-oriented programming)– Wikipedia
Prev Article
Next Article

Related Articles

MySQL Between and Not Between Operators
MySQL Between and Not Between Operators: MySQL Between Operator is …
Gk Scientist November 14, 2022 Computer

MySQL Between and Not Between Operators

Java Super Keyword
Java Super Keyword: We can use the Eclipse IDE for …
Gk Scientist January 11, 2023 Computer

Java Super Keyword

MySQL IN Operator
MySQL IN Operator: (1) In MySQL, the IN operator is …
Gk Scientist November 12, 2022 Computer

MySQL IN Operator

Java Polymorphism
Java Polymorphism: An important concept in inheritance is that an …
Gk Scientist January 12, 2023 Computer

Java Polymorphism

Create a Text Editor in Python
Create a Text Editor in Python: We can use the …
Gk Scientist December 25, 2022 Computer

Create a Text Editor in Python

Create Database in MySQL
Create Database in MySQL: (1) In order to create a …
Gk Scientist November 10, 2022 Computer

Create Database in MySQL

MySQL Select Query with Where Clause
MySQL Select Query with Where Clause: (1) In the previous …
Gk Scientist November 11, 2022 Computer

MySQL Select Query with Where Clause

Google Search Console and Google Analytics
What are Google Search Console and Google Analytics? Google remains …
Gk Scientist November 2, 2022 Computer

Google Search Console and Google Analytics

Leave a Reply Cancel Reply

Search




  • Popular
  • Recent




GK SCIENTIST

General Knowledge One Stop Source

Information

  • About Us
  • Terms and Condition, Disclaimer
  • Contact Us

Android Apps

  • IAS App For English Medium Students
  • IAS Basics App For English Medium Students
  • IAS Hindi App For Hindi Medium Students
DMCA.com Protection Status

Popular Tags

Biology (33) Biology Questions (88) Chemistry (57) Computer (214) Current Affairs (4) Current Content (0) Economy (10) English Essay (172) English Grammar (75) English Literature (10) Geography (83) History (259) Indian Anthropology (11) Indian Polity (14) JKAS Mains Question Papers (17) Mathematics (68) Moral Science (7) NCERT & Other Boards Books (25) Philosophy (114) Physics (89) Political Science (132) RS TV News (33) Science (553) Social Anthropology (7) Social Science (17) Solved Paper (47) UPSC (7) UPSC Mains Question Papers (26)

Downloads

  • NCERT Books
  • Old NCERT Books
  • NIOS Books For IAS, SSC, and State PSC Exam
  • Tamil Nadu Board Books: Important For UPSC, SSC, and State PSC Exam
  • Modern Indian and World History Notes For IAS Exam
  • UPSC Topper 2013 Gaurav Agrawal Notes For IAS Preparation
  • UPSC IAS Prelims General Studies – Previous Year Papers
  • UPSC Mains Question Papers

Copyright © 2023 GK SCIENTIST
Theme by MyThemeShop.com& Hosted On Cloudways

Ad Blocker Detected

Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker.

Refresh
 

Loading Comments...