24 lines
438 B
C++
24 lines
438 B
C++
#include <iostream>
|
|
using namespace std;
|
|
|
|
class MyClass {
|
|
public:
|
|
int x;
|
|
private:
|
|
int y;
|
|
};
|
|
|
|
int main() {
|
|
MyClass classObject;
|
|
|
|
/*
|
|
Here we try to access the y variable ;
|
|
But that is not accessible to us cause its a private Value ;
|
|
If that y were accessed inside of that function everything would be fine!
|
|
*/
|
|
|
|
classObject.x = 25;
|
|
classObject.y = 50;
|
|
|
|
return 0;
|
|
} |