- Remember not to return reference to a local object/variable in any function. As local variable/objects dies as soon as function ends.
- Remember not to return a dynamically allocated object (using new operator). User of the function may forget corresponding delete call.
- Remember not to return reference to a local static object/variable in any function say f().
In this case f(obj1, ...) = = f(obj2, ...) will always comes true. - Instead return the object by value.
Cheers and try hosting at Linode.
No comments:
Post a Comment