自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(9)
  • 收藏
  • 关注

转载 操作符重载

需要注意的是操作符重载,赋值操作符必须返回*this; 输入输出操作符不能作为类的成员函数,一般应声明为friend; 关系操作符应定义为内联函数,也应为非成员函数; #include "stdafx.h"#include <iostream>using namespace std;class myClass{public: myClass(int ,int ,char...

2012-06-14 23:38:00 70

转载 bitset

#include <bitset>#include <iostream>using namespace std;int _tmain(int argc, _TCHAR* argv[]){ bitset<30>myBitSet; myBitSet.set(0); myBitSet.reset(0); myBitSet |=1UL<<27; m...

2012-06-14 22:57:00 75

转载 宏和template<class T>

#include "stdafx.h"#include <iostream>using namespace std;#define ARRYLEN(arry)(sizeof(arry)/sizeof(arry[0]))template <class T>int ArryLen(T&arry){ return (sizeof(arry)/sizeof(a...

2012-06-14 22:33:00 122

转载 类不能继承接口,只能实现接口

#include "stdafx.h"#include <iostream>using namespace std;class abstractClass{public: virtual void printFS() = 0; virtual int get_value() = 0;}; class inheritClass:public abstractClass{pub...

2012-06-13 23:11:00 324

转载 简单的策略模式,类模版

#include "stdafx.h"#include <iostream>using namespace std;template<class T>class Operation{public: virtual void Algorithm() = 0;}; template<class T>class Add:public Operation&...

2012-06-02 16:17:00 52

转载 dynamic_cast

dynamic_cast 动态类型转换,必须有虚函数。 #include "stdafx.h"#include <iostream>using namespace std; class Basic{public: virtual void funOfBasic(){cout<<"this is the basic's fun"<<endl;}}; ...

2012-06-02 12:47:00 50

转载 String类的构造函数和析构函数

近期遇到一些困惑。行动的过程中瞻前顾后,不能酣畅淋漓。困惑是因为模糊,业余时间把这些东西搞清楚。 1、类何时需要自己的析构函数?  当类的构造函数在执行过程中申请了一些资源,销毁类的对象时需要收回这些资源。  一个相当经典的例子: #include <iostream>using namespace std;class String{public:String(con...

2012-05-30 22:11:00 132

转载 常量的使用

多个编译单元使用方式有两种:   方式一: 在头文件中: static const int buffSize = 100;   //   方式二:   在头文件中:extern const int buffSize;   在对应的源文件中 const int buffSize = 100;   //   如果在方式二的头文件中如下定义:extern const ...

2012-05-28 22:44:00 73

转载 #ifdef 和#ifndef

classParent.h头文件 #ifndef PARENT_H#define PARENT_Hclass classParent{public:classParent(){} protected:private:int inumOfParent;};#endif "classChild.h"头文件 #ifndef CHILD_H#define CHILD_H...

2012-05-23 23:02:00 85

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除