物件104-1

 avatar
user_6817964
c_cpp
a year ago
524 B
3
Indexable
Never
#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;
}