C++中类的定义

来源:互联网 发布:mac桌面图标删不掉 编辑:程序博客网 时间:2024/04/28 01:17
 在c++中定义类
 
 class 类名{
 public:
   //属性
   属性列表;
   //方法
   函数列表;
 };
 
 class Plane{
 public:
   int hp;
   int px,py;
   int price;
   string name;
   
   void fly()
   {
     ....
    }
   void fire(int x,int y)
   {
    ...
   }
 };
0 0
原创粉丝点击