Limitations of initialization list
From: Marcin Kalicinski (kalita_at_poczta.onet.pl)
Date: 08/31/04
- Next message: Victor Bazarov: "Re: Limitations of initialization list"
- Previous message: Christopher Benson-Manica: "Re: Tutorial for beginner/ Tutorial voor beginner"
- Next in thread: Victor Bazarov: "Re: Limitations of initialization list"
- Reply: Victor Bazarov: "Re: Limitations of initialization list"
- Reply: Phlip: "Re: Limitations of initialization list"
- Reply: Julián Albo: "Re: Limitations of initialization list"
- Reply: Chris Theis: "Re: Limitations of initialization list"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 31 Aug 2004 15:45:06 +0200
Hi,
Constructor of derived class needs to do some complex things before it calls
base class constructor. There is an ugly solution:
bool ComplexThingToDo()
{
// ...
return false; // dummy
}
class Derived: public Base
{
bool dummy;
public:
Derived(): dummy(ComplexThingToDo()), Base() { }
};
But I'm afraid that sequence of initializers in initialization list does not
enforce the actual sequence of execution. So this ugly solution will not
work. Is there another way? Perhaps it is an example of bad design, doing
some complex things before calling base class constructor?
Best regards,
Marcin
- Next message: Victor Bazarov: "Re: Limitations of initialization list"
- Previous message: Christopher Benson-Manica: "Re: Tutorial for beginner/ Tutorial voor beginner"
- Next in thread: Victor Bazarov: "Re: Limitations of initialization list"
- Reply: Victor Bazarov: "Re: Limitations of initialization list"
- Reply: Phlip: "Re: Limitations of initialization list"
- Reply: Julián Albo: "Re: Limitations of initialization list"
- Reply: Chris Theis: "Re: Limitations of initialization list"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]