Content deleted Content added
m →Operator methods: Improve C++ example |
m →Virtual functions: Improve C++ example |
||
Line 134:
#include <memory>
class Super {
public:▼
virtual ~Super() = default;
▲public:
};
class Sub : public Super {
public:▼
▲public:
▲ void iAm() { std::cout << "I'm the subclass!\n"; }
};
int main() {
▲ std::unique_ptr<Super> inst2(new Sub());
}
</syntaxhighlight>
|