Question: Define two classes A and B each having one integer private data member. Write zero argument and parameterized constructors to initialize the data member and
Define two classes A and B each having one integer private data member. Write zero argument and
parameterized constructors to initialize the data member and member functions to get, set and
display the data member for these classes. Write a swap function which takes the arguments as
class A and class B objects and exchanges the data members of these two objects. Write a main
function which creates instances of the classes A and B assigns values to each and swaps the
value of data member of these objects using the swap function. Display the objects before and
after swapping.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
