恋恋风辰的个人博客


  • Home

  • Archives

  • Categories

  • Tags

  • Search

C++类成员空间分配和虚函数表

Posted on 2017-08-03 | In C++

最近在自学python,看到继承和类,就顺便复习了C++的类和继承等方面的知识。
先看Base基类

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class Base {

private:

virtual void display() { cout<<"Base display()"<<endl; }

void say(){ cout<<"Base say()"<<endl; }

public:

virtual void func(){cout << "Base func()" << endl; }
void exec(){ display(); say(); }

void f1(string a) { cout<<"Base f1(string)"<<endl; }

void f1(int a) { cout<<"Base f1(int)"<<endl; } //overload

};
Read more »
<1…4041

401 posts
18 categories
21 tags
RSS
GitHub ZhiHu
© 2026 恋恋风辰 本站总访问量次 | 本站访客数人
Powered by Hexo
|
Theme — NexT.Muse v5.1.3