We can not only pass objects as function arguments but can also return objects from functions. We can return an object in the following three ways: Returning by value which makes a duplicate copy of the local object. Returning by using a reference to the object. In this way the address of the object is passed implicitly to the calling function. Returning by using the ‘this pointer’ which explicitly sends the address of the object to the calling function. Following program demonstrates the three ways of returning objects from a function: 1 2 3 4 5 6 7 8
The post How to return objects in Function C++ programming appeared first on Coding Security.
How to return objects in Function C++ programming
read more