郁金香 中级班 1.c++的类和对象

#include<stdio.h>
class 生物
{
public:
    生物()
    {
        printf("我是构造函数\n");
    }
    int id1;
    int id2;
    float x;
    float y;
    void mov()
    {
        printf("我是这个类的对象函数\n");
    }
};


int main()
{

    生物 a;
    a.id1 = 3;
    a.mov();
    return 0;
}

 

posted @ 2022-10-31 17:06  逆向狗  阅读(34)  评论(0)    收藏  举报