class Derived; class Base{public: Base() = default; Base(const Derived &d) = delete; Base& operator=(const Derived& other) = delete;}; class Derived : public Base{}; int main(){ Derived d; Base b = d;}
Standard input is empty
prog.cpp: In function ‘int main()’: prog.cpp:19:14: error: use of deleted function ‘Base::Base(const Derived&)’ Base b = d; ^ prog.cpp:8:5: error: declared here Base(const Derived &d) = delete; ^
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!