c++11 - Declare 'virtual' constructor for base and derived class in c++? -


maybe trivial problem: have base class b has constructor many (6+) arguments (and it's not stable maybe change in future). , there many derived classes inherit has same constructor signature, , of them nothing more base one.

so problem is: there way declare 1 time in base , no need declare in derived classes? normal virtual function.

i'm using c++11.

you can inherit base class constructors:

struct base {     base(int, float, void*, bool, std::nullptr_t, std::size_t) { /* ... */ } };  struct derived : base {     using base::base; };    derived d(0,0.0f, nullptr, false, nullptr, 0); 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -