Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Computer
- {
- private:
- int inventarNummer;
- char* osName;
- int zustand;
- public:
- Computer(){};
- Computer(int a, char *b, int c){
- inventarNummer = a;
- osName = b;
- zustand = c;
- }
- Computer(const Computer &c){
- inventarNummer = c.inventarNummer;
- osName = c.osName;
- zustand = c.zustand;
- }
- void info(){
- cout<<inventarNummer<<" "<<osName<<" "<<zustand<<endl;
- }
- Computer operator=(Computer c){
- Computer temp;
- temp.inventarNummer = c.inventarNummer;
- temp.osName = c.osName;
- temp.zustand = c.zustand;
- return temp;
- }
- };
- int main()
- {
- Computer o1(10,(char*)"MacOS",0);
- Computer o2(o1);
- Computer *o3;
- Computer *o4;
- o3 = new Computer(15,(char*)"Windows",1);
- o4 = new Computer;
- o4 = o3;
- o1.info();
- o2.info();
- o3->info();
- o4->info();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement