some changes ; mostly new examples
This commit is contained in:
24
OOP/access_specifier/ex1.cpp
Normal file
24
OOP/access_specifier/ex1.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user