Skip to content
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

Merged

Conversation

raghav-97
Copy link
Contributor

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

  • Adding a new entry
    Added multilevel-inheritance.md

Checklist

  • All writings are my own.
  • My entry follows the Codecademy Docs style guide.
  • My changes generate no new warnings.
  • I have performed a self-review of my own writing and code.
  • I have checked my entry and corrected any misspellings.
  • I have made corresponding changes to the documentation if needed.
  • I have confirmed my changes are not being pushed from my forked main branch.
  • I have confirmed that I'm pushing from a new branch named after the changes I'm making.
  • I have linked any issues that are relevant to this PR in the Issues Solved section.

@PragatiVerma18 PragatiVerma18 self-requested a review January 29, 2025 12:46
@PragatiVerma18 PragatiVerma18 self-assigned this Jan 29, 2025
Copy link
Collaborator

@PragatiVerma18 PragatiVerma18 left a 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.
Copy link
Collaborator

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 -

Suggested change
**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
Copy link
Collaborator

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 -

Suggested change
```cpp
```pseudo


## Syntax

In C++, multilevel inheritance follows this general syntax:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In C++, multilevel inheritance follows this general syntax:
In C++, multilevel inheritance follows this syntax:


## Example

Simple example to demonstrate multilevel inheritance in C++
Copy link
Collaborator

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 -

Suggested change
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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add relevant doc links -

Suggested change
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.

Copy link
Collaborator

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
Copy link
Contributor Author

Hey @PragatiVerma18 I have made the suggested changes, let me know if anything more is required.
Thank You.

Copy link
Collaborator

@PragatiVerma18 PragatiVerma18 left a 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! 🚀

@mamtawardhani mamtawardhani added status: under review Issue or PR is currently being reviewed and removed status: ready for next review labels Jan 31, 2025
@mamtawardhani mamtawardhani self-assigned this Jan 31, 2025
Copy link
Collaborator

@mamtawardhani mamtawardhani left a 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! 🚀

@mamtawardhani mamtawardhani added status: review 2️⃣ completed and removed status: under review Issue or PR is currently being reviewed labels Feb 5, 2025
@mamtawardhani mamtawardhani merged commit e3dc4b5 into Codecademy:main Feb 5, 2025
7 checks passed
Copy link

github-actions bot commented Feb 5, 2025

👋 @raghav-97
You have contributed to Codecademy Docs, and we would like to know more about you and your experience.
Please take a minute to fill out this four question survey to help us better understand Docs contributions and how we can improve the experience for you and our learners.
Thank you for your help!

🎉 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.
If you're appearing as anonymous and want to be credited, visit the linked accounts page and ensure that your GitHub account is linked.

@mamtawardhani mamtawardhani linked an issue Feb 5, 2025 that may be closed by this pull request
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Term Entry] C++ Inheritance: Multilevel Inheritance
3 participants