摘要:
面试例题4:这个类声明正确吗?为什么? class A { const int size=0; } 答:这道程序题存在着成员变量问题,常量必须在构造函数初始化列表里面初始化或者将其设置为static。结构如下: class A { static const int size=0;//(属于类内初始化 阅读全文
摘要:
(来源于:http://blog.chinaunix.net/uid-25132162-id-1564955.html) 1、空类,空类单继承,空类多继承的sizeof #include <iostream> using namespace std; class Base1 { }; class B 阅读全文