
C++
iteye_9920
这个作者很懒,什么都没留下…
展开
-
类对象作为数据成员
Father.h #ifndef FATHER_H#define FATHER_H#include"Mother.h"class Father{public: Father(int a,int b); ~Father(void);private: Mother m; int i;};#endif Father.cpp ...原创 2012-07-17 16:21:02 · 218 阅读 · 0 评论 -
C++解析xml
需要导入xml的文件,附件中有 需要解析的XML <?xml version="1.0" encoding="UTF-8" ?><db> <db_ip>127.0.0.1</db_ip> <db_port>3306</db_port> <dbnam2013-10-09 20:11:35 · 145 阅读 · 0 评论 -
友元函数的用法
外部的函数,访问类中的私有变量 #include <iostream>using namespace std;class Message{ public: Message(int a,int b):x(a),y(b){} friend void showMessage(Message &msg); private: in...2013-01-03 18:05:22 · 152 阅读 · 0 评论 -
运算符重载的三种方法
#include<iostream.h>class Complex{ public: Complex(int a,int b):x(a),y(b){} friend const Complex operator+(Complex &c1,Complex &c2); // friend const Complex operator-(Comp...2013-01-03 21:00:12 · 994 阅读 · 0 评论 -
list,vector,map的使用方法
Player *playerOne = new Player("player one"); Player *playerTwo = new Player("player two"); Player *playerThree = new Player("player three"); Player *playerFour = new Player("player four"); P...2014-02-07 21:33:07 · 166 阅读 · 0 评论 -
指向函数的指针
第一种类型: int max(int a, int b){ if (a >= b) { return a; } else { return b; }}typedef int(*getMax)(int, int);getMax fn = max;CCLog("max:%...2014-03-28 22:51:48 · 139 阅读 · 0 评论