c++ - Initialize member before base constructor. Possible? -


i have following code:

class a{ public:     a(int* i){         std::cout << "in a()" << << std::endl;     } };  class b: public a{ public:     b(): i{new int{10}}, a{i}{         std::cout << "in b()" << std::endl;      }  private:     int* i; };  int main() {     b b; } 

in a constructor have 0 (which expected). want initialize i before. possible @ all?

i data member of class b, in order created, object of class b has created first. answer, no.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -