lundi 28 janvier 2019

Can class member be initialized with another class member in the initializer list?

Suppose I have class with two members,

class App
{
public:
   App() : window(1366, 768, "Title"), drawer(w) {}
private:
   Window window;
   Drawer drawer;
}

and the Drawer class has constructor Drawer(const Window&).
Is it valid to initialize the App class member Drawer with the another class member Window, like in this example?

Aucun commentaire:

Enregistrer un commentaire