Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class clase1
- {
- public:
- int num;
- char letra;
- clase1(int _num, char _letra): num(_num), letra(_letra){}
- };
- int main()
- {
- clase1 objeto1(1,'a');
- clase1 objeto2(2,'b');
- clase1 aux(0,' ');
- cout << "objeto1 antes "<<objeto1.num << " " << objeto1.letra<<endl;
- cout << "objeto2 antes "<<objeto2.num <<" "<<objeto2.letra<< endl;
- aux=objeto1;
- objeto1=objeto2;
- objeto2=aux;
- cout<<endl;
- cout << "objeto1 despues "<<objeto1.num<< " " << objeto1.letra<<endl;
- cout << "objeto2 despues "<<objeto2.num<<" "<<objeto2.letra <<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement