Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- using namespace std;
- class CClass
- {
- public:
- int publicInt=1;
- protected:
- int protectedInt=2;
- private:
- int privateInt=3;
- };
- class CClass2 : CClass
- {
- public:
- int returnPublicInt()
- {
- return publicInt;
- }
- int returnProtectedInt()
- {
- return protectedInt;
- }
- /*
- int returnPrivateInt()
- {
- return privateInt;
- }
- */
- };
- int main()
- {
- CClass2 ccl1;
- cout << "publicInt=" << ccl1.returnPublicInt() << '\n';
- cout << "protectedInt=" << ccl1.returnProtectedInt() << '\n';
- //system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement