mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-04-27 15:43:58 +00:00
[C++/en] Small inheritance clarification
Clarified that private members are inherited but are not directly accessible
This commit is contained in:
parent
8592f26199
commit
e32eb715ef
@ -404,6 +404,8 @@ int main() {
|
|||||||
// Inheritance:
|
// Inheritance:
|
||||||
|
|
||||||
// This class inherits everything public and protected from the Dog class
|
// This class inherits everything public and protected from the Dog class
|
||||||
|
// as well as private but may not directly access private members/methods
|
||||||
|
// without a public or protected method for doing so
|
||||||
class OwnedDog : public Dog {
|
class OwnedDog : public Dog {
|
||||||
|
|
||||||
void setOwner(const std::string& dogsOwner);
|
void setOwner(const std::string& dogsOwner);
|
||||||
|
Loading…
Reference in New Issue
Block a user