MCPcopy Create free account
hub / github.com/changkun/modern-cpp-tutorial / Subclass

Class Subclass

code/2/2.7.cpp:33–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31 }
32};
33class Subclass final : public Base {
34public:
35 double floating;
36 Subclass() = delete;
37
38 // 继承构造
39 Subclass(double f, int v, std::string s) : Base(s, v) {
40 floating = f;
41 }
42
43 // 显式重载
44 virtual void foo(int v) override {
45 std::cout << v << std::endl;
46 value = v;
47 }
48}; // 合法 final
49
50// class Subclass2 : Subclass {
51// }; // 非法, Subclass 已 final

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected