Copying objects to other

#include<iostream>
using namespace std;
class myclass
{
int i;
public:
void set(int n) {i=n;}
int show() {return 1;}
};
int main()
{
myclass ob1,ob2;
ob1.set(99);
ob2=ob1;
cout<<“this is ob2’s “<<ob2.show();
return 0;
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s