Move constructor for derived class
I have 2 classes: template<typename T> class base{ T t; public: base(base &&b): t(std::move(b.t)){} }; template<typename T, typename T2> class derived : protected base<T>{ T2 t2; public: derived(derived &&d): base<T>(std::move(d)), t2(std::move(d.t2)){} }; I move entire d object in the derived move-constructor to initialize base part and d becomes invalid but I still need it to use it's part for t2 initialization Is it possible to do such a thing? I would say that your construct is correct except for a little syntax error, you need to qualify base<T> in the initializer list: derived(derived &