?? early.cpp
字號:
//: C15:Early.cpp
// From Thinking in C++, 2nd Edition
// Available at http://www.BruceEckel.com
// (c) Bruce Eckel 1999
// Copyright notice in Copyright.txt
// Early binding & virtuals
#include <iostream>
using namespace std;
class Base {
public:
virtual int f() const { return 1; }
};
class Derived : public Base {
public:
int f() const { return 2; }
};
int main() {
Derived d;
Base* b1 = &d;
Base& b2 = d;
Base b3;
// Late binding for both:
cout << "b1->f() = " << b1->f() << endl;
cout << "b2.f() = " << b2.f() << endl;
// Early binding (probably):
cout << "b3.f() = " << b3.f() << endl;
} ///:~
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -