Bismillahir Rahmanir Rahim
Assignment 2:
Write a program that will demonstrate assigning objects. The program that uses the following properties- class name- B, integer type private member variable- c, d, two public member functions- set_data(int m, int n), display(), two objects- e, f.
The output will be:
67 55
67 55
Solution:
#include<iostream.h> class B { int c,d; public: int setdata(int m,int n) { c=m; d=n; return (c,d); } void disply() { cout<<c<<"\t"<<d<<endl; } }; void main() { B e,f; e.setdata(67,55); f=e; e.disply(); f.disply(); }