Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- using namespace std;
- class CClass
- {
- int CClassInt=1;
- };
- class CClass2 : CClass
- {
- public:
- int returnCClassInt()
- {
- return CClassInt;
- }
- };
- int main()
- {
- CClass2 ccl1;
- cout << "CClassInt=" << ccl1.CClassInt() << '\n';
- //system("pause");
- return 0;
- }
- /************************************** Compiler Output **************************************
- |7|warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]|
- ||In member function ‘int CClass2::returnCClassInt()’:|
- |7|error: ‘int CClass::CClassInt’ is private|
- |15|error: within this context|
- ||In function ‘int main()’:|
- |7|error: ‘int CClass::CClassInt’ is private|
- |23|error: within this context|
- |23|error: expression cannot be used as a function|
- ||=== Build failed: 5 error(s), 1 warning(s) (0 minute(s), 0 second(s)) ===|
- ************************************** Compiler Output **************************************/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement