![](https://img-blog.csdnimg.cn/20190918140129601.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
C & C++
记录一些C&C++的学习笔记
首席IT民工
编程才是真爱^_^
展开
-
C语言内存结构的研究
考虑下面的一段代码 #include <stdio.h> typedef struct{ int a[2]; double d; } struct_s; double fun(int i){ volatile struct_s s; s.d=3.14; s.a[i]=1073741824; printf("%f",s.d); return 0; } int main(){原创 2020-07-02 08:23:22 · 115 阅读 · 0 评论 -
C++指向类成员函数的指针的使用示例
#include "stdafx.h" #include using namespace std; class A { private: int val; public: A(int i) { val = i; } int value(int a) { return val + a; } }; int main() { int(A::*pfun)(int); pf原创 2015-09-27 21:13:25 · 454 阅读 · 0 评论 -
vector的自动扩容
#include "stdafx.h" #include #include using namespace std; int main() { vectora(10), b(10); cout << a.empty() << ","<< sizeof(a) << ","; for (char i = 'a', j = 0; j < 10; j++) a[j] = i + j;原创 2015-09-29 21:41:13 · 3853 阅读 · 0 评论 -
当虚函数遇到多继承
#include "stdafx.h" #include using namespace std; class Father { public: virtual void func() { cout << "Father" << endl; } //virtual void func() = 0; }; class Mather { public: void func() { c原创 2015-09-30 07:23:22 · 805 阅读 · 0 评论 -
C++多继承的研究
#include "stdafx.h" #include using namespace std; class GrandMa { public: GrandMa(); void Show(); }; class Mather :public GrandMa { public: Mather(); }; class Father { public: Father(); void Sh原创 2015-09-29 19:48:46 · 766 阅读 · 0 评论 -
涉及虚函数的继承
#include "stdafx.h" #include using namespace std; class A{ public: void func() { cout << "A" << endl; } }; class B :public A{ public: virtual void func() { cout << "B" << endl; } }; class C :原创 2015-10-01 09:25:27 · 456 阅读 · 0 评论