40 lines
447 B
C++
40 lines
447 B
C++
#include <iostream>
|
|
|
|
class S {
|
|
// void print() const { a = 3; std::cout << S::a << '\n'; }
|
|
int a = 0;
|
|
|
|
public:
|
|
S(int x) : x(x) {
|
|
}
|
|
int x{2};
|
|
};
|
|
|
|
class X {
|
|
int x;
|
|
|
|
public:
|
|
X() : x(0) {};
|
|
void get() {
|
|
std::cout << "x; " << x << '\n';
|
|
}
|
|
int& y() {
|
|
return x;
|
|
}
|
|
};
|
|
|
|
int main() {
|
|
// S{}.print();
|
|
// S.x;
|
|
// std::cout << S{3}.x << '\n';
|
|
|
|
X x;
|
|
auto& ret = x.y();
|
|
|
|
// ++ret;
|
|
|
|
x.get();
|
|
|
|
// X x;
|
|
return 0;
|
|
}
|