mardi 3 janvier 2017

Using too many functions

I'm reading a book in which a window class' constructor doesn't initialize all the implementation directly, instead it calls a function that calls another etc...

e.g.

window::window(T&t, X&x)
{ setup(t, x);}

void window::setup(T&t, X&x)
{
//initializing implementation details, size, title etc...
create(t, x);

void window::create(T&t, X&x)
{
//initializing the library Window
//...
}

Same with the destructor, callind a destroy() function instead of doing so in the destructor itself.

Is it just a matter of style or is it of any practical use?

Aucun commentaire:

Enregistrer un commentaire