C++
步棋晟
这个作者很懒,什么都没留下…
展开
-
Visual Studio 2015上C++各种基础类型及标准库容器大小的测试
基础类型测试 本栏包括基础类型大小测试,还包括其他一些测;测试代码如下 namespace ns_01 { void test_01(int a) { cout << "test_01"; } void test() { enum color { red, green, blue }; cout << "(void *)test_01:" << sizeof((void *)test_01) << endl; cout <&l.原创 2020-07-20 11:33:16 · 311 阅读 · 0 评论 -
malloc与new在使用虚函数实现多态上的问题
malloc与new在使用虚函数实现多态上的问题1.构建三个类使用malloc的问题使用new原因使用malloc的解决方案 1.构建三个类 class base { private: int i; public: base(){}; base(int num) :i(num) {}; virtual void fun1() { cout << "base::fun1" &...原创 2020-05-02 18:07:51 · 273 阅读 · 0 评论