<pre>//====================== start of sample.cpp ========================== class Input { public: Input(); ~Input(); }; class USBInput: public Input { public: USBInput(); virtual ~USBInput(); }; class Device { public: Device(); ~Device(); }; class USBDevice: virtual public Device { public: USBDevice(); virtual ~USBDevice(); }; class ManualUserDev: public virtual USBInput { public: ManualUserDev(); virtual ~ManualUserDev(); }; class Key { public: Key(); ~Key(); }; class Keyboard: public Input, public Key { public: Keyboard(); ~Keyboard(); };//====================== end of sample.cpp ========================== </pre> Для которых из классов в файле sample.cpp в конструкторе может потребоваться явно вызвать конструкторы базовых классов?
<pre>//====================== start of sample.cpp ========================== class Input { public: Input(); }; class USBInput: public Input { public: USBInput(): Input() {} }; class Device { public: Device(); }; class ManualUserDev: public Device { public: ManualUserDev() : Device() {} }; class Keyboard: public USBInput, public ManualUserDev { public: Keyboard(): ManualUserDev(), USBInput() {} };//====================== end of sample.cpp ========================== </pre> Тело конструктора какого класса будет исполнено последним перед вызовом тела конструктора Keyboard при создании класса типа Keyboard?
<pre>//====================== start of sample.cpp ========================== class Input { public: Input(); ~Input(); }; class USBDev { public: ~USBDev(); }; class USBInput: public Input { USBDev m_dev; public: USBInput(): Input() {} ~USBInput(); }; class Device { public: Device(); ~Device(); }; class ManualUserDev: public Device { public: ManualUserDev() : Device() {} ~ManualUserDev(); }; class Key { public: ~Key(); }; class Keyboard: public USBInput, public ManualUserDev { Key* key; public: Keyboard(): ManualUserDev(), Input() {key = new Key();} ~Keyboard() { delete key; } };//====================== end of sample.cpp ========================== </pre> В каком порядке вызываются деструкторы при удалении объекта Keyboard из файла sample.cpp?
<pre>//====================== start of sample.cpp ========================== class Person { public: short m_age; const char* m_name; const char* m_surname; }; class Library { public: long m_books_count; std::string m_name; static std::string m_city; }; class Program { public: std::string prog_name; long version; void* prog_data; }; class Region { public: short country_code; short city_code; std::shared_ptr<Library< main_library; };//====================== end of sample.cpp ========================== </pre> Для какого из классов в фрагменте файла sample.cpp необходима реализация своего оператора копирования?
<pre>//====================== start of sample.cpp ========================== class Person { public: long GetAge(); bool IsMale(); }; class Trader: private Person { public: long GetAge(); long GetAccount(); }; class Worker { public: long GetExperience(); long GetSalary(); }; class Developer : public Worker, private Person { }; class Boss: protected Worker { public: unsigned short GetLevel(); const char* GetDepartment(); }; class HeadOfAll: public Boss {};//====================== end of sample.cpp ========================== </pre> Для какого из производных классов в файле sample.cpp наследование выполнено для наследования интерфейса?
<pre>//====================== start of sample.cpp ========================== class Input { public: Input(); ~Input(); virtual void f(); }; class ManualUserDev: public Input { public: ManualUserDev(); virtual ~ManualUserDev(); }; class Keyboard: public Input { public: Keyboard(); ~Keyboard(); }; int main() { Keyboard keyboard; Input& rinp = keyboard; Input* pinp = &:keyboard; ManualUserDev& rmy_mdev = dynamic_cast<ManualUserDev&>(rinp); ManualUserDev* pmy_mdev = dynamic_cast<ManualUserDev*>(pinp); Keyboard& rmy_keyboard = dynamic_cast<Keyboard&>(rinp); Keyboard* pmy_keyboard = dynamic_cast<Keyboard*>(pinp); return 0; }//====================== end of sample.cpp ========================== </pre> При инициализации какой переменной в файле sample.cpp будет брошено исключение?
<pre> //====================== start of sample.cpp ========================== class User { public: const char* get_name() const; inline int get_age const; private: volatile double get_balance(); mutable char* get_job_name(); protected: long long get_phone_number(); static int get_phone_prefix(); }; //====================== end of sample.cpp ========================== </pre> Какие методы класса User объявлены корректно?
<pre> //====================== start of sample.cpp ========================== class User { public: const char* name; inline int age; private: volatile double balance; mutable char* job_name; protected: long long phone_number; static int phone_prefix = 499; }; //====================== end of sample.cpp ========================== </pre> Какие атрибуты класса User объявлены корректно?
<pre> //====================== start of sample.cpp ========================== template<unsigned long N> class binary { public: static unsigned long const value = binary<N / 10>::value << 1 | N % 10; }; template<> class binary<0> { public: static unsigned long const value = 0; }; template<> class binary<1> { public: static unsigned long const value = 1; }; int main(int argc, char* argv[]) { static unsigned const x0 = binary<0>::value; static unsigned const x1 = binary<1000>::value; static unsigned const x2 = binary<1001>::value; static unsigned const x3 = binary<1010>::value; static unsigned const x4 = binary<1011>::value; return 0; } //====================== end of sample.cpp ========================== </pre> При инициализации какой переменной не будет использоваться конкретизация шаблона с параметром 0?
<pre> //====================== start of sample.cpp ========================== template <class Receiver> class MyCommand: public Command { public: typedef void (Receiver::* Action)(); MyCommand(Receiver r, Action a): _receiver(r), _action(a){} void Execute(); int GetStatus(); private: Action _action; Receiver* _receiver; int _last_error; }; //====================== end of sample.cpp ========================== </pre> Какие атрибуты и методы класса MyCommand являются необходимыми для имплементации шаблона команда в файле sample.cpp?