Class example in C/C++
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.
随机推荐
- 0x66 Tarjan算法与无向图联通性
bzoj1123: [POI2008]BLO poj3694 先e-DCC缩点,此时图就变成了树,树上每一条边都是桥.对于添加边的操作,相当于和树上一条路径构环,导致该路径上所有边都不成为桥.那么找这 ...
- open Command window here
http://www.sevenforums.com/tutorials/134831-open-command-window-here-add-remove.html 按照教程里面,下载一个脚本 需 ...
- 【NOIP 2009】 靶形数独
[题目链接] https://www.luogu.org/problemnew/show/P1074 [算法] 搜索 + 剪枝 [代码] #include<bits/stdc++.h> u ...
- [HTML&CSS] 条件注释判断浏览器
<!--[if !IE]><!--> 除IE外都可识别 <!--<![endif]--><!--[if IE]> 所有的IE可识别 <![e ...
- Javascript万物皆对象?
在javascript的世界里,有这么一句话,万物皆对象. 但是这个对象,应该怎么理解呢? exm........??,难道值类型也是对象?!! 当然,不是. 准确地讲是对于“引用类型”而言. 那,在 ...
- Paint、Canvas.2
1:使用Cavans画个简单图形 2:过程 2.1:绘制最外部的圆 /*** 初始化 paint */ Paint paint; paint = new Paint(); paint.setColor ...
- vs2012下 error4996
原文链接:http://blog.csdn.net/xidianzhimeng/article/details/11457045 分类: VS使用学习 2013-09-09 08:37 24人阅读 评 ...
- PCL:PCL与MFC 冲突总结
(1):max,min问题 MFC程序过程中使用STL一些类编译出错,放到Console Application里一切正常.比如: void CMyDialog::OnBnClickedButton1 ...
- pandaboy Merry Christmas
- 路飞学城Python-Day101
57-多表操作之一对多添加纪录 def add(request): # pub = Publish.objects.create(name='人民出版社', email='873245193@qq.c ...