物件104-1
user_6817964
c_cpp
3 years ago
524 B
8
Indexable
#include <iostream>
using namespace std;
class SuperStar{
public :
int id = 1;
int age = 1;
SuperStar(int a, int b)
{
id = a;
age = b;
}
void Show();
int getID(){return id;}
~SuperStar(){}
};
void Show(SuperStar obj){
cout << obj.getID() << endl;
}
void SuperStar::Show(){
cout << getID() << endl;
}
SuperStar s1(1, 18);
int main()
{
int s1 = 2;
Show(::s1);
return 0;
}
Editor is loading...