#include <random> #include <iostream> struct Base { virtual void f()=0; }; struct Derived: Base { // void f() override; // NEED DECLARATION }; void Derived::f(){} int main() { Derived d; }
Standard input is empty
prog.cpp:14:17: error: no 'void Derived::f()' member function declared in class 'Derived'
void Derived::f(){}
^
prog.cpp: In function 'int main()':
prog.cpp:18:13: error: cannot declare variable 'd' to be of abstract type 'Derived'
Derived d;
^
prog.cpp:9:8: note: because the following virtual functions are pure within 'Derived':
struct Derived: Base
^
prog.cpp:6:18: note: virtual void Base::f()
virtual void f()=0;
^
Standard output is empty