C++面向对象实践

2020-12-13 05:45

阅读:468

标签:std   span   pac   cout   实践   namespace   pre   ace   eth   

实践如下:

class Person{

private:
    int age;
    char name[25];
    int hight;

public:
    Person(int age, int hight, char* name);
    int getAge();
    char* getName();
    int getHight(){
        return hight;
    }
};
#include "Person.h"


Person::Person(int age, int hight, char* name1){
    Person::age = age;
    Person::hight = hight;
    Person::name = name1;
}

int Person::getAge(){
    return age;
}

char* Person::getName(){
    return name;
}
#include 

#include "Person.h"

using namespace std;

int main(){

    cout "面向对象实践:"  endl;


    cout "end."  endl;

    return 0;
}

 

C++面向对象实践

标签:std   span   pac   cout   实践   namespace   pre   ace   eth   

原文地址:https://www.cnblogs.com/do-your-best/p/11147888.html


评论


亲,登录后才可以留言!