Explain protected, public, private in C++?
These are three access spaecifiers in C++.
- Public - Here data members and functions are accessible outside the class.
- Protected - Data members and functions are available to derived classes only.
- Private - Data members and functions aren't accessible outside the class.