- #pragma once
- class CStudent
- {
- public:
- CStudent(void);
- CStudent(int age,int score);
- public:
- ~CStudent(void);
- public:
- int age;
- int score;
- static int totalScore;
- };
- #include "StdAfx.h"
- #include "Student.h"
- CStudent::CStudent(void)
- {
- }
- CStudent::~CStudent(void)
- {
- }
- CStudent::CStudent(int age, int score)
- {
- this->age=age;
- this->score=score;
- totalScore =score;
- }
- int CStudent::totalScore=0;
注意:在类外初始化 这和C#不同