+ 6
Something Witty But Purely Logical This Time
How can you stop objects from being copied. Objects are copied when we pass them through call by value method, return an object, or ob1=ob2. So I want you to figure out how you can stop from objects being copied.
3 Answers
+ 2
Well don't take it as a question Take it up as a challenge.
I do not want to deal with original objects but.
I want that if any object is being copied in program anywhere it should produce error or stop compilation. That is if I insert that part of code in some other program and if that program is copying objects anywhere in the program an error should be reported by compiler.
0
pass it as reference i.e put &before the object name in the parameter list.
but the function must accept it as a pointer
0
Define a private copy constructor and assignment operator would do the trick i believe...