码迷,mamicode.com
首页 > 编程语言 > 详细

Class example in C/C++

时间:2017-06-25 10:03:54      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:content   hit   and   player   div   oid   post   methods   which   

class Player {
 private:
  int health; //these are the attributes
  int strength;
  int agility;




 public:
void move();
void attackEnemy(); //these are the method prototypes
void getTreasure();


};


Every Player object which gets created has three integers called health, strength and agility for its attributes.


The methods we can perform on a Player object are move, attackEnemy and getTreasure.

Class example in C/C++

标签:content   hit   and   player   div   oid   post   methods   which   

原文地址:http://www.cnblogs.com/llguanli/p/7076091.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!