自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(24)
  • 资源 (7)
  • 收藏
  • 关注

原创 重载,覆盖,隐藏

<br />#include <iostream.h>class Base{public: virtual void f(float x) { cout<<"Base::f(float)"<<x<<endl; } void g(float x) { cout<<"Base::g(float)"<<x<<endl; } void h(float x) { cout<<"Base::h(float)"<<x<<endl; }};

2011-01-14 10:53:00 244

原创 类的常量

<br />#include <iostream>using namespace std;class A{public: A(int size); const int SIZE; void go() { cout<<SIZE<<endl; }};A::A(int size):SIZE(size){ }void main(){ A a(100); A b(200); a.go(); b.go();}<br /

2011-01-14 09:46:00 192

原创 函数

<br />#include <iostream.h>int &count(int);int a,b;void main(){int x;cout<<"Input numbers,the 0 is end:/n";/*cin>>x;while(x){count(x)++;cin>>x;}*/do{ cin>>x; count(x)++;}while(x);cout<<"the number of right:"<<a<<

2011-01-14 09:18:00 262

原创 纯虚函数使用

<br />#include <iostream><br />using namespace std;<br />class Figure<br />{<br />protected:<br /> double x,y;<br />public:<br /> void set(double i,double j) {x=i;y=j;}<br /> virtual void area()=0;<br />};<br />class Triangle:public Figure<br />{<br />publ

2011-01-10 17:26:00 195

原创 虚析构函数

<br />#include <iostream>using namespace std;class A{public: virtual ~A() {cout<<"call A::~A()"<<endl;}};class B:public A{char *buf;public: B(int i) {buf=new char[i];} virtual ~B() {delete []buf;cout<<"call B::~()"<<endl;

2011-01-10 17:19:00 172

原创 函数的联系

<br />#include <iostream>using namespace std;class B{public: void f() {cout<<"bf";} virtual void vf() {cout<<"vbf";} void ff() {vf(); f();}; virtual void vff() {vf();f();}};class D:public B{public: void f() {cout<<"df";} voi

2011-01-10 17:10:00 158

原创 内存分配

<br />#include <iostream><br />using namespace std;<br />class A<br />{<br /> int x;<br />public:<br /> void setname(int i)<br /> {x=i;<br /> cout<<x<<endl;<br /> }<br />};<br />class B:public A<br />{<br /> char *y;<br />public:<br /> B() {y=new char[];}<

2011-01-10 16:46:00 140

原创 虚函数调用

<br />#include <iostream>using namespace std;class B{public: void f() {g();} virtual void g() {cout<<"B::g";}};class D:public B{public: void g() {cout<<"D::g";}};void main(){D d;d.f();}

2011-01-10 16:38:00 143

原创 虚函数用法

<br />#include <iostream>using namespace std;class B{public: virtual void f(int i) {cout<<"B::f"<<endl;}};class D:public B{public: int f(char c) {cout<<"D::f..."<<c<<endl;}};void main(){D d;B *pB=&d,&rB=d,b;pB->f('1');

2011-01-10 16:23:00 211

原创 不用指针只能调用基类

<br />#include <iostream>using namespace std;class B{public: virtual void f() {cout<<"B::f"<<endl;}};class D:public B{public: void f() {cout<<"D::f"<<endl;}};void main(){B *pB=&d,&rB=d,b;D d;b=d;b.f();pB->f();r

2011-01-10 16:15:00 182

原创 虚函数特性

#include #include using namespace std;class A{public: void f(int i) {coutf(1);pA=&b; pA->f(1);pA=&c; pA->f(1);pA=&d; pA->f(1);}虚特性在定义和继承他的类

2011-01-10 16:03:00 323

原创 虚函数

<br />#include <iostream>#include <string>using namespace std;class Employee{public: Employee(string Name,string id) {name=Name;Id=id;} string getName() {return name;} string getID() {return Id;} float getSalary() {return 0.0;} void pri

2011-01-10 15:44:00 292

原创 基类与派生类对象的关系

<br />#include <iostream>using namespace std;class A{int a;public: void setA(int x) {a=x;} int getA() {return a;}};class B:public A{int b;public: void setB(int x) {b=x;} int getB() {return b;}};void f1(A a,int x) {a.

2011-01-09 17:32:00 316

原创 虚基类由最终派生类初始

<br />#include <iostream.h>class A{int a;public: A(int x) {a=x;cout<<"Virtual Base A..."<<endl; }};class B:virtual public A{public: B(int i):A(i) {cout<<"Virtual Base B..."<<endl; }};class C:virtual public A{

2011-01-09 17:12:00 398

原创 虚拟继承实现

<br />#include <iostream>using namespace std;class A{int a;public: A() {cout<<"Constructing A"<<endl;}};class B{public: B() {cout<<"Constructing B"<<endl;}};class B1:virtual B,virtual public A{public: B1(int i) {cout<<"C

2011-01-09 16:56:00 416

原创 虚拟继承的定义方式

<br />#include <iostream>using namespace std;class A{public: void vf() {cout<<"I come from class A"<<endl;}};class B:virtual public A {};class C:virtual public A {};class D:public B,public C {};void main(){D d;d.vf();}

2011-01-09 16:38:00 190

原创 多继承方式 构造函数析构函数

<br />#include <iostream>using namespace std;class Base1{private: int x;public: Base1(int a=1) { x=a; cout<<"Base1 constructor x="<<x<<endl; } ~Base1() {cout<<"Base1 destructor..."<<endl;}};class Base2{private: int y;

2011-01-09 16:28:00 280

原创 多重继承的成员名二义性

<br />#include <iostream>using namespace std;class A{public: void f() {cout<<"From A"<<endl;}};class B{public: void f() {cout<<"From B"<<endl;}};class MI:public A,public B{public: void g() {cout<<"From MI"<<endl;}};v

2011-01-09 16:08:00 253

原创 多重继承

<br />#include <iostream>using namespace std;class Base1{private: int x;protected: int getx() { return x; }public: void setx(int a=1) {x=a;}};class Base2{private: int y;public: void sety(int a) {y=a;} int gety()

2011-01-09 15:53:00 207

原创 构造函数和析构函数的调用次序

<br />#include <iostream>using namespace std;class B{public: B() {cout<<"Constructing B"<<endl;} ~B() {cout<<"Destructing B"<<endl;}};class C{public: C() {cout<<"Constructing C"<<endl;} ~C() {cout<<"Destructing C"<<endl;}};c

2011-01-08 16:25:00 277

原创 友元(一)

<br />#include <iostream>using namespace std;class B;class A{private: int x,y;public: A(int i,int j) {x=i;y=j;} int sum(B b);};class B{private: int z;public: B(int i=0) {z=i;} friend int A::sum(B b);};int A::sum(B b)

2011-01-08 15:45:00 127

原创 友元函数(二)

[code]#include using namespace std;class A{private: int x,y;public: A(int i,int j) {x=i;y=j;} int getX() {return x;} int getY() {return y;} friend class B;};class B{private: int z;public: int add(A a) {return a.x+a.y+z;} int mul(A a) {return a.x*a.y*z;} B(

2011-01-08 15:36:00 167

原创 友元函数

#include #include using namespace std;class point{private: int x,y; friend int dist1(point p1,point p2);public: point(int a=10,int b=10) {x=a; y=b; } int getx() {return x;} int gety() {return y;}};int dist1(point p1,point p2){double x=(p2.x-p1.x);double y=

2011-01-08 15:28:00 149

原创 sd

<br />sad

2011-01-08 01:57:00 176

C++面向对象多线程编程.part03.rar

[大家网]C++面向对象多线程编程.part03.rar

2011-02-20

C++面向对象多线程编程.part02.rar

C++面向对象多线程编程.part02.rar

2011-02-20

C++面向对象多线程编程.part01.rar

C++面向对象多线程编程.part01.rar

2011-02-20

VC++6游戏编程.chm

VC++6游戏编程.chm

2011-02-20

数据结构与算法分析C语言描述.pdf数据结构与算法分析C语言描述.pdf

数据结构与算法分析C语言描述.pdf数据结构与算法分析C语言描述.pdf

2011-02-07

数据结构与算法大全数据结构与算法大全

数据结构与算法大全数据结构与算法大全数据结构与算法大全数据结构与算法大全

2011-02-07

空空如也

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

TA关注的人

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