<pre> //====================== start of sample.h ========================== struct A {}; struct B; struct B *pb = 0; struct A *pa = 0; struct B b; struct A a; void foo(const struct B& in_b); //====================== end of sample.h ========================== </pre> Какие присвоения и объявления в файле sample.h валидны?
<pre> //====================== start of sample.cpp ========================== struct A {}; struct B {}; struct C {}; struct D {}; struct E {}; struct F {}; int main() { try { foo(); } catch(const A& a) {} catch(static const B*) {} catch(C c) {} catch(volatile D* d) {} catch(virtual E* e) {} catch(F*&) {} catch(...) { return 5; } return 0; } //====================== end of sample.cpp ========================== </pre> Обработчики исключений какого типа записаны неправильно?
<pre> //====================== start of sample.cpp ========================== #include <boost/variant/variant.hpp> struct A {}; struct B { B(int src); private: B(const B& src); }; struct C { C(int src); private: C(); }; struct D {}; int main(int argc, char* argv[]) { boost::variant<int, A, B, C> myvariant; int x; int* y; A a; B b(x); C c(x); D d; myvariant = x; myvariant = y; myvariant = a; myvariant = b; myvariant = c; myvariant = d; return 0; } //====================== end of sample.cpp ========================== </pre> Какие объекты можно присвоить объекту myvariant из примера в файле sample.cpp?
<pre> //====================== start of sample.cpp ========================== struct A {}; struct B; struct B *pb = new B; struct A *pa = new A; struct B b = *pb; class C { struct B m_b; }; class D { struct A m_a; }; //====================== end of sample.cpp ========================== </pre> Какие присвоения и объявления в файле 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.cpp ========================== struct A {}; struct B {}; struct C {}; struct D {}; struct E {}; struct F {}; void foo(int i) try { switch(i) { case 1: throw A(); case 2: throw B(); case 4: throw D(); default: throw F(); } } catch(A&) { } catch(B&) { throw D(); } catch(D&) { throw C(); } catch(...) { throw; } int main(int argc, char* argv[]) { try { foo(argc); } catch(const A& a) {} catch(const B*) {} catch(C c) {} catch(E* e) {} catch(...) { return 5; } return 0; } //====================== end of sample.cpp ========================== </pre> При каких значении argc программа вернёт значение 5?
<pre> //====================== start of sample.cpp ========================== struct A {}; struct B {}; struct C {}; struct D {}; struct E {}; struct F {}; class BaseIO { public: virtual int state() throw(A) = 0; virtual void read() throw(A, B) = 0; virtual void write() throw (C, D) = 0; virtual void open() throw (E,F) = 0; virtual void close() throw() = 0; }; class DiskIO: public BaseIO { public: virtual int state() throw(); virtual void read() throw (A, B); virtual void write() throw (C); virtual void open() throw (A, E); virtual void close() throw (F); }; //====================== end of sample.cpp ========================== </pre> Перегрузка каких виртуальных методов базового класса в классе DiskIO выполнена корректно?
<pre> //====================== start of sample.cpp ========================== template <typename T> class multiplies: public binary_function<T,T,T> { public: T operator() (const T& x, const T& y) const { return x * y; } }; //====================== end of sample.cpp ========================== </pre> Какие утверждения про приведённый выше код функтора multiplies верны?
<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 являются необходимыми для поддержки идиомы контекстно-зависимой перегрузки операции индексирования агрегата?