/*
* stock1.h
*
* Created on: 2014年10月30日
* Author: Administrator
*/
#ifndef USER_H_
#define USER_H_
class User{
private:
int age;
public:
User(int age);//构造函数
~User(); //析构函数
void show();
};
#endif /* USER_H_ */
/*
* user.cpp
*
* Created on: 2014年10月30日
* Author: Administrator
*/
#include<iostream>
#include "../header/user.h"
using namespace std;
int main(){
User user(12);
user.show();
return 0;
}
User::User(int age){
this->age = age;
}
User::~User(){
cout << "~User" << endl;
}
void User::show(){
cout << this->age << endl;
}