Skip to content

protected-cpp.md - grammar and consistency #4990

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

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/cpp/protected-cpp.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The **`protected`** keyword specifies access to class members in the *member-lis

When preceding the name of a base class, the **`protected`** keyword specifies that the public and protected members of the base class are protected members of its derived classes.

Protected members are not as private as **`private`** members, which are accessible only to members of the class in which they are declared, but they are not as public as **`public`** members, which are accessible in any function.
Protected members are not as private as **`private`** members, which are accessible only to members of the class in which they are declared but they are not as public as **`public`** members, which are accessible in any function.

Protected members that are also declared as **`static`** are accessible to any friend or member function of a derived class. Protected members that are not declared as **`static`** are accessible to friends and member functions in a derived class only through a pointer to, reference to, or object of the derived class.

Expand Down Expand Up @@ -75,7 +75,7 @@ int main() {
y.Display();
// x.Protfunc(); error, Protfunc() is protected
y.useProtfunc(); // OK, uses public access function
// in derived class
// in the derived class
}
```

Expand Down