Run ❯
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
#include
using namespace std; class MyClass { public: // Public access specifier int x; // Public attribute private: // Private access specifier int y; // Private attribute }; int main() { MyClass myObj; myObj.x = 25; // Allowed (x is public) myObj.y = 50; // Not allowed (y is private) return 0; }
In function 'int main()':
Line 8: error: 'int MyClass::y' is private
Line 14: error: within this context