<pre>//====================== start of sample.cpp ========================== class Input { public: Input(); }; class Output { public: Output(); }; class USBInput { }; class USBOutput { }; class SimpleComputer { long m_memory; const char* m_processor; Input m_input; Output m_output; public: long GetPerformance(); void Start(); void Reset(); }; class PersonalComputer: public SimpleComputer { USBInput m_input; UserOutput m_output; }; class LaptopComputer: public PersonalComputer { const char* m_processor; public: void Start(); void Reset(); };//====================== end of sample.cpp ========================== </pre> Какие атрибуты и методы базового класса SimpleComputer в файле sample.cpp остались не перекрыты в унаследованном классе LaptopComputer?
<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 ARef { public: ARef(A &a, int i) : _a(a), _ix(i) {} ARef& operator= (T t) { return *this;} operator T() {return _t;} operator A() {return _a;} A& getA() { return _a;} bool operator == (A& a) {return _a == a;} private: A& _a; int _ix; T _t; }; class A { friend class ARef; public: A() {} ARef operator[] (int ix) {return ARef(*this, ix);} operator ARef() {return ARef(*this, ix);} }; //====================== end of sample.cpp ========================== </pre> Какие из методов класса ARef из файла sample.cpp являются необходимыми для поддержки идиомы контекстно-зависимой перегрузки операции индексирования агрегата?
<pre> //====================== start of sample.h ========================== struct S_EMPTY {}; struct A { int i; double g; }; class B { long jj; public: char _str[6]; private: static char str_4_all[9]; }; union mytypes_t { int i; float f; } My; //====================== end of sample.h ========================== </pre> Доступ к каким из членов класса, описанных в файле sample.h (выше), является открытым?
<pre> //====================== start of sample.h ========================== struct S_EMPTY {}; struct A { int i; double g; }; class B { long jj; public: char _str[6]; private: static char str_4_all[9]; }; union mytypes_t { int i; float f; } My; //====================== end of sample.h ========================== </pre> Доступ к каким из членов класса, описанных в файле sample.h (выше), является закрытым?
<pre> //====================== start of sample.hpp ========================== class ARef { public: /* Сonstructory */ ARef(A& a, int i) : _a(a), _ix(i) {} /* operator= */ ARef& operator= (T t) { return *this;} private: A& _a; // Reference to A object int _ix; // index in container }; class BRef { public: BRef(B &b, int i) : _b(b), _ix(i) {} BRef& operator= (T t) { return *this;} private: B& _b; int _ix; }; /* * Class CRef имплементирует шаблон проектирования X * хранит в себе ссылку на коллекцию типа A, которая является коллекцией * объектов типа T и предоставляет к ним доступ */ class CRef { public: CRef(C &c, int i) : _c(c), _ix(i) {} CRef& operator= (T t) { return *this;} private: C& _c; /* та коллекция объектов, доступ к которой и предоставляется*/ int _ix; /* индекс текущего объекта в контейнере */ }; /* * Class DRef */ class DRef { public: // конструктор инициализирует объект DRef(D &d, int i) : m_d(d), _ix(i) {} // оператор возвращает ссылку на себя DRef& operator= (T t) { return *this;} private: D& m_d; // хранимый объект int _ix; // индекс }; //====================== end of sample.hpp ========================== </pre> Комментарии какого из классов в файле sample.hpp являются необходимыми и достаточными?
<pre> //====================== start of sample.cpp ========================== template <class Element, unsigned long max_size> class Storage { public: Storage(Element) {} }; template <class Element> class Storage <Element, 0 /* unlimited*/> { public: Storage(Element e) {} }; template <unsigned long max_size> class Storage <int, max_size> { public: Storage(int e) {} }; template <> class Storage<char*, 0> { public: Storage(char* s) {} }; template <> class Storage<char*, 100> { public: Storage(char* s) {} }; int main() { int p1=4; Storage<int, 5> st1(p1); Storage<char*, 100> st2(char* s); Storage<double, 80000> st3(double n); Storage<double, 0> st4(double n); return 0; } //====================== end of sample.cpp ========================== </pre> Какой из шаблонов Storage в файле sample.cpp не задействован в функции main в файле 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 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<typename T> typename T::difference_type my_diff( T& v1, T& v2); template<typename T> T my_diff2(T& v1, T& v2); class A { public: A(int in = 5); typedef short difference_type; difference_type operator-(A&); }; int main() { A i(5); A j(10); my_diff(i,j); int x = 5; int y = 10; my_diff(x,y); return 0; } //====================== end of sample.cpp ========================== </pre> Какие проблемы может решить использование идиомы SFINAE в вышеприведённом коде?