void CClass2::Exec(){ if(canCreateC1()) class1 = new CClass1();}
class CClass1{...static CClass1 *getInstance();...};CClass1 *CClass1::getInstance(){ ... if (ok) return new CClass1; else return 0;}