![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c++
gorunbu
很烦。。。。。。。。。。。。。。。
展开
-
overload override hide
一、重载(overload)1.作用域相同; 2.函数名字相同; 3.函数参数不同 编译器生成的函数名字不同,名字粉碎】; 4.与 virtual 关键字无关;void print(int a) {cout<<"print(int): "<<a<<endl;} void print(double a) {cout<<"print(float): "<<a<<endl;} class base原创 2015-04-26 15:11:26 · 474 阅读 · 0 评论 -
override operator <<
19.override operator << struct topic_descript { btstring topic_url; //RuleEngine/LineDetector/Crossed btstring name_space; bt原创 2015-06-15 09:29:16 · 973 阅读 · 0 评论 -
C++中的函数指针和函数对象
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <iostream> #include <string> #include <algorithm>using namespace std;//c++ function object // class Add // { // public: // int翻译 2015-08-23 22:39:58 · 502 阅读 · 0 评论 -
C++ Bit Fields
C++ Bit FieldsVisual Studio 2010 Other Versions Classes and structures can contain members that occupy less storage than an integral type. These members are specified as bit fields. The syntax for bit-翻译 2015-07-06 14:50:40 · 489 阅读 · 0 评论 -
C++ enum and namespace
#include <iostream>#include <stdio.h>using namespace std;namespace bug { enum month1 { January = 1, February = 2 }; enum month2 { January2 = 3, February2 = 4 }; class bug1 { pub原创 2015-06-29 17:48:48 · 1678 阅读 · 0 评论 -
C++ member function pointer
//1.derived class can call the base class function, but the base class can not call the derived class function, member pointer can not do it //2.c++ member function is strict //3.the size of C++ poi原创 2015-05-07 16:37:36 · 956 阅读 · 0 评论 -
c++ object parameter and return
1. 2.#include <stdio.h>#include <iostream> #include <string>using namespace std; #define DBG(...) class object_arg { string name; // Object identifier static int objectCount; public: obj原创 2015-05-07 10:58:53 · 413 阅读 · 0 评论 -
C++强制类型转换 dynamic_cast
1.must have a virtual function; 2. must have some relationship between the source pointer and the destination pointer 3. a invalid pointer can call the adress[pointer and function ], but can’t ca原创 2015-05-05 16:17:28 · 1865 阅读 · 0 评论 -
c++ cast 总结
1.旧式强制转换依赖于所涉及的数据类型,具有与 const_cast、 static_cast 和 reinterpret_cast 一样的行为。 在合法使用 static_cast 或 const_cast 的地方,旧式强制转换提供了与各自对应的命名强制转换一样的功能。 如果这两种强制转换均不合法,则旧式强制转换执行 reinterpret_cast 功能。dynamic_cast 是 C++ 对转载 2015-05-11 11:59:52 · 664 阅读 · 0 评论 -
C++友元
http://www.cppblog.com/deercoder/archive/2010/01/12/105530.aspxC++友元的一个问题-----------由派生类访问基类的私有成员 继承是一个永恒的话题,可是带来的问题却也是多多啊。最近一直在思考一些细节的东西,于是也有了不少收获。今天,当我想要用派生类访问基类的私有成员时,发现问题了…… 代码1:(没有问题,对照下面的代码来看错误之处转载 2015-04-21 09:05:55 · 420 阅读 · 0 评论 -
成员函数默认参数
如何在类成员函数中默认引用类成员? class CAbc; class CAbc { private: int m_abc; public: void fun0(int &p=NULL)//编译错误 { printf("%d",p); }void fun1(const int &p=NULL)//编译通过 { printf("%d",p); } void fun2(int &p=this->m_ab转载 2015-04-17 09:58:24 · 929 阅读 · 0 评论 -
const,template,pointer,virtual
typdef 以及 typename 声明类型 时候,需要注意与const 使用时的 修饰作用。 //pointer operator, not allowed //error: invalid operands of types ‘int*’ and ‘int*’ to binary ‘operator+’【指针不能重载运算符】 #include <stdio.h> #include <stdli原创 2015-04-30 19:13:51 · 448 阅读 · 0 评论 -
str_to_ip ,ip_to_str
unsigned int str_to_ip(const char *pStr) { signed char j = 0; unsigned char cIp; unsigned int uiRet = 0; const char *p = pStr;cIp = (unsigned char)atoi(p); uiRet |= ( ((unsigned in原创 2015-04-27 20:06:32 · 709 阅读 · 0 评论 -
c++成员函数默认参数
c++成员函数默认参数 多文件编写注意.h file#ifndef PARAMETER_H_ #define PARAMETER_H_class cabc { private: char m_abc; static int def; public: //error: invalid use of non-static data member 'cabc::m_abc'原创 2015-04-17 10:44:57 · 5780 阅读 · 0 评论 -
tinyXml learning
some resource come from network, thanks all this people!#include <string> #include <iostream> #include <tinyxml.h> using std::string; using std::cout; using std::endl;struct xmlNodeList{ TiXmlNode原创 2015-07-14 11:19:07 · 290 阅读 · 0 评论