Though the class is a user-defined data type, it still behaves like a built-in data type. It means we can do almost everything with class and object of a class that we can do with built-in data types. This is the real beauty of Object Oriented Programming.
The function is a self-contained block of a program which performs a predefined task. In normal practice, we can easily pass integer, float, character, array, structure variable, pointer variable as an argument to a function. In the same way, it is possible to pass one or more objects of a class as an argument to a function. In my program when the statement "t1.sum(t3);" appears, it means the t1 object is going call a function named as the sum and object t2 get passed as an argument to the function. Inside the sum function members of object t1 (which is responsible for the call) are accessed directly and members of object t2(which is passed as an argument) are accessed using . (dot) operator.
Below is the program which may satisfy you. Please include iostream.h and conio.h header files before the definition of class.
//PROGRAM TO SHOW OBJECT AS A FUNCTION ARGUMENT
time(int hr, int mn, int sc)
time sum(time t1)
cout<<"\nHours = "< cout<<"\nMinutes = "< cout<<"\nSeconds = "<
cout<<"Enter hours, minutes and seconds for first object\n";
class time t1(hr,mn,sc);
cout<<"Enter hours, minutes and seconds for second object\n";
class time t2(hr,mn,sc);
class time t3;
cout<<"\nTime details of first object are as follows\n";
cout<<"\nTime details of second object are as follows\n";
cout<<"\nAfter sumation of two objects time details of time summation are as follows\n";