物件導向104mid
user_3763047219
c_cpp
2 years ago
684 B
2
Indexable
#include <iostream> using namespace std; //error1 class SuperStar{ //error2 class int id; int age; //error3 «Øºc¤l public: void Show(SuperStar );//error5 SuperStar int getID(){return id;} void Show(){cout<<"SuperStar No."<<getID()<<"say\"Hello!\""<<endl;} SuperStar(int n1=1, int n2=1){ id=n1;age=n2; } };//error7 ; void SuperStar::Show(SuperStar obj){//error 4 :: cout<<"Superstar No."<<obj.getID()<<"say\"Hello!\""<<endl; } SuperStar s1(1,18);//error 4¡B6 SuperStar s2; int main(){ //int s1 = 2; s1.Show(s1); s1.Show(); s2.Show(s2); s2.Show(); return 0; }
Editor is loading...