C++mid104_1
user_3763047219
c_cpp
a year ago
730 B
0
Indexable
Never
#include <iostream> using namespace std; //error1 class SuperStar{ //error2 class int id=1; int age=1; //error3 public://error4 void Show( );//error5 SuperStar int getID(){return id;} SuperStar(int n1=1, int n2=1){ id=n1;age=n2; } ~SuperStar(){ cout<<"De"<<endl; } //error6 };//error7 ; void Show(SuperStar obj){//error 4 :: cout<<"Superstar No."<<obj.getID()<<"say\"Hello!\""<<endl; } void SuperStar::Show(){cout<<"SuperStar No."<<getID()<<"say\"Hello!\""<<endl;} SuperStar s1(2,18); SuperStar s2; int main(){ int s1 = 2;//error8 Show(::s1); ::s1.Show(); Show(s2); s2.Show(); return 0; }