Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Default copy
#include <iostream> using namespace std; class Foo{ public: int bar, *baz; Foo(int x): bar(x){ baz = new int; *baz = 2; } }; int main(){ Foo x(5); Foo y(6); y = x; //bar and baz copied cout << "Before baz edit:" << endl; cout << x.bar << ' ' << y.bar << endl; cout << *x.baz << ' ' << *y.baz << endl; *x.baz = 0; //only x was changed cout << "After edit:" << endl; cout << x.bar << ' ' << y.bar << endl; cout << *x.baz << ' ' << *y.baz << endl; }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Microsoft - MaxEmployeeAttendence (R repititions - DP solution bitmask)
IceCream
HeatPump COP
HeapDoubLinArr
NameTempSpecial2
2222aaaa
Kth smallest element
EqualIdentical
semiprog.cpp
CodeForces Div 3 - D
Please log in to post a comment.