// // Created by darren on 17-9-30. // #ifndef TEST_1_CLASS_TEST_H #define TEST_1_CLASS_TEST_H
#include <iostream> #include <string.h> #include <stdlib.h> #include <assert.h> #include <errno.h> #include <stdio.h> using namespace std; class Human{ public: Human(char *name, char* &gender, int lWeight); Human(Human &am); int eat(); int run(); void setAttribute(int age, int heighe); //attribute inline void printf(){ cout<<"height"<<height<<endl; cout<<"age:"<<age<<endl; cout<<"weight:"<<weight<<endl; cout<<"gender:"<<gender<<endl; cout<<"myName:"<<myName<<endl; } ~Human(); private: int height; int age; char* myName; char* &gender; const int weight; public: static int iNumber; //在类外对static类型的数据成员进行初始化 }; #endif //TEST_1_CLASS_TEST_H
// // Created by darren on 17-9-30. // #include "1_class_test.h" using namespace std; int Human::iNumber =0; int Human::eat() { cout << "we eat the food" << endl; return 0; }
int Human::run() { cout << "we running" << endl; }