mirror of
https://github.com/Light-City/CPlusPlusThings.git
synced 2026-04-05 03:31:01 +08:00
support bazel complie this project and format code.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
/* 从基类继承的成员将访问到派生类版本.cpp */
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
class B {
|
||||
public:
|
||||
void f() { g(); }
|
||||
virtual void g() { cout << "B::g"; }
|
||||
};
|
||||
class D : public B {
|
||||
public:
|
||||
void g() { cout << "D::g\n"; }
|
||||
};
|
||||
int main() {
|
||||
D d;
|
||||
d.f();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user