Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Assigment operator (easy)
#include <iostream> class Base { int a; public: Base(int Value):a(Value){;} Base():a(0){;} int Get(){return a;} Base& operator=(const Base &Obj) { a = Obj.a; return *this; } }; int main() { Base A(8); Base B(2); std::cout<<"A: "<<A.Get()<<'\n'; std::cout<<"B: "<<B.Get()<<'\n'; std::cout<<"B = A;\n"; B = A; std::cout<<"A: "<<A.Get()<<'\n'; std::cout<<"B: "<<B.Get()<<'\n'; }
run
|
edit
|
history
|
help
0
Dulce enredo p1
constructing object on first use as return value of (pointer to) object-returning function
20201123
5345
Policy based smart pointer
decrypt_problem_5
1068 - Investigation
Stock buy/sell, maximum subarray problem
fcyyfc
GoF interpreter