I have a class Foo that is initialized with a filename or null. If there is a filename, the object db is initialized, otherwise it is null. Either way, the object db_mon is initialized with the value of db, null or not.
Is this valid:
class Foo {
Database *db;
Database_monitor db_mon;
public:
Foo(const char *db_file) :
db(db_file ? new db(db_file) : 0), db_mon(db) {}
};