Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- class Student//新建一個Student類別
- {
- public://public的
- int age;
- void output()//新建一個output()函數
- {
- cout << "age=" << age << endl;
- }
- };
- int main()
- {
- Student S1;//新建一個Student物件S1
- S1.age = 19;//將S1的age設為19
- S1.output();//呼叫S1的output()
- system("pause");
- return 0;
- }
Add Comment
Please, Sign In to add comment