Personal channel of @lancern
Topics: programming, hacking, memes, life, and more. Forward anything as you wish.
Join the discussion group for more fun.
Discord: https://discord.gg/RwUx9et7
Topics: programming, hacking, memes, life, and more. Forward anything as you wish.
Join the discussion group for more fun.
Discord: https://discord.gg/RwUx9et7
发现一个完全没用的 C++ 语言“特性”
可以使用
但是在子类中,你也必须使用
另外,在子类中你也不能使用
可以使用
= deleted
来定义一个虚函数:
struct B { virtual void m() = deleted; };
但是在子类中,你也必须使用
= deleted
来定义对 m
的重写:
struct D : B {
void m() override; // ERROR
void m() override = deleted; // OK
};
另外,在子类中你也不能使用
= deleted
来重写一个在父类中没有被定义为 = deleted
的虚函数:
struct B { virtual void m(); };
struct D : B {
void m() override = deleted; // ERROR
};