//
// Human.h // 头文件
//
#ifndef HUMAN_H_INCLUDED
#define HUMAN_H_INCLUDED
#include <iostream>
class Human
{
public:
void SetHeight(int);
int GetHeight();
private:
int height;
};
#endif // HUMAN_H_INCLUDED
//
// Human.cpp // 源文件
//
#include "Human.h"
void Human::SetHeight(int x)
{
height = x;
}
int Human::GetHeight()
{
return height;
}
//
// main.cpp
//
#include <iostream>
#include "Human.h"
int main()
{
Human Mike;
Mike.SetHeight(180);
std::cout << "Mike的身高:" << Mike.GetHeight() << std::endl;
return 0;
}