摘要:
C++调用虚函数的时候,要根据实例(即this指针指向的实例)中虚函数表指针得到虚函数表,再从虚函数表中找到函数的地址。#includeclass shape {public: int a; shape(int t) { a=t; } virtual void area() ... 阅读全文
posted @ 2015-05-09 22:43
南哥的天下
阅读(244)
评论(0)
推荐(0)
摘要:
#includeclass shape {public: int a; shape(int t) { a=t; } virtual void area()=0;};class circle: public shape { public: void area(); circl... 阅读全文
posted @ 2015-05-09 22:28
南哥的天下
阅读(172)
评论(0)
推荐(0)
摘要:
C++堆和栈的分配 栈区(stack)— 由编译器自动分配释放 ,存放函数的参数值,局部变量的值等,其操作方式类似于数据结构中的栈。 堆区(heap) — 一般由程序员分配释放, 若程序员不释放,程序结束时可能由OS回收,注意它与数据结构中的堆是两回事,分配方式类似于链表。 全局区(静态区)(sta 阅读全文
posted @ 2015-05-09 22:16
南哥的天下
阅读(171)
评论(0)
推荐(0)
摘要:
#include using namespace std;struct A1{ int a; static int b; };struct A2{ int a; char c;};struct A3{ float a; char c;};struct A4{... 阅读全文
posted @ 2015-05-09 00:20
南哥的天下
阅读(273)
评论(0)
推荐(0)
摘要:
#include using namespace std;class A{ int m_a; int get() { return m_a; } virtual void set(int a) { m_a = a; } vi... 阅读全文
posted @ 2015-05-09 00:16
南哥的天下
阅读(481)
评论(0)
推荐(0)
摘要:
//a.cpp class A{ public: int fun(int x){ return (x*x+1000); } }; void tt() { } //b.cpp class A{ public: int fun(int x); }; void tt(); int yy() { tt(); 阅读全文
posted @ 2015-05-09 00:09
南哥的天下
阅读(400)
评论(0)
推荐(0)
浙公网安备 33010602011771号