-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New entry Multilevel Inheritance #6049
New entry Multilevel Inheritance #6049
Conversation
This reverts commit 21029b3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @raghav-97, thanks for contributing to the docs; this entry looks good. I have some suggestions. Please check the comments and make the required changes, and then this will be good for a second review.
Feel free to let me know if you have any questions or doubts; I will be happy to help you.
- 'paths/computer-science' | ||
--- | ||
|
||
**Multilevel inheritance** is an Object-Oriented Programming (OOP) concept where a class can inherit properties and methods from a class that is already inherited from another class, creating a hierarchy of classes. This forms a parent-child-grandchild relationship between classes, allowing for the creation of specialized classes based on existing ones. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add docs link to OOP concepts -
**Multilevel inheritance** is an Object-Oriented Programming (OOP) concept where a class can inherit properties and methods from a class that is already inherited from another class, creating a hierarchy of classes. This forms a parent-child-grandchild relationship between classes, allowing for the creation of specialized classes based on existing ones. | |
**Multilevel inheritance** is an [Object-Oriented Programming (OOP)](https://www.codecademy.com/resources/docs/general/programming-paradigms/object-oriented-programming) concept where a class can inherit properties and methods from a class that is already inherited from another class, forming a hierarchical class structure. This forms a parent-child-grandchild relationship between classes, enabling the creation of specialized classes from existing ones. |
|
||
In C++, multilevel inheritance follows this general syntax: | ||
|
||
```cpp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use pseudo
code blocks for syntax -
```cpp | |
```pseudo |
|
||
## Syntax | ||
|
||
In C++, multilevel inheritance follows this general syntax: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In C++, multilevel inheritance follows this general syntax: | |
In C++, multilevel inheritance follows this syntax: |
|
||
## Example | ||
|
||
Simple example to demonstrate multilevel inheritance in C++ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be better written as following -
Simple example to demonstrate multilevel inheritance in C++ | |
Here's an example demonstrating multilevel inheritance in C++: |
} | ||
``` | ||
|
||
This example demonstrates how multilevel inheritance allows a class to inherit features from multiple levels of parent classes, creating a clear and organized hierarchy of related classes. The C++ implementation includes additional features like virtual functions for proper polymorphic behavior and access specifiers (public, protected, private) to control member accessibility. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add relevant doc links -
This example demonstrates how multilevel inheritance allows a class to inherit features from multiple levels of parent classes, creating a clear and organized hierarchy of related classes. The C++ implementation includes additional features like virtual functions for proper polymorphic behavior and access specifiers (public, protected, private) to control member accessibility. | |
This example demonstrates how multilevel inheritance allows a class to inherit features across multiple levels, forming a structured class hierarchy. The implementation includes virtual functions for proper [polymorphic behavior](https://www.codecademy.com/resources/docs/cpp/polymorphism) and access specifiers (`public`, `protected`, `private`) to control member accessibility. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should move this above the code block - we try to keep the explanation very short for codebyte examples and they are the last part of the entry.
…/raghav-97/docs into new-entry-multilevel-inheritance
Hey @PragatiVerma18 I have made the suggested changes, let me know if anything more is required. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @raghav-97, thanks for making the changes so quickly. This is good for a second review! 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for contributing to Codecademy Docs @raghav-97 😄
The entry looks good to be merged! 🚀
👋 @raghav-97 🎉 Your contribution(s) can be seen here: https://www.codecademy.com/resources/docs/cpp/inheritance/multilevel-inheritance Please note it may take a little while for changes to become visible. |
Description
Created a new documentation entry for
Multilevel Inheritance
that explains the concept with practical C++ examples.This entry goes into
docs/content/cpp/concepts/inheritance/terms/multilevel-inheritance/multilevel-inheritance.md
.Issue Solved
Closes: [Term Entry] C++ Inheritance: Multilevel Inheritance #6018
Type of Change
Added
multilevel-inheritance.md
Checklist
main
branch.Issues Solved
section.