База ответов ИНТУИТ

Программирование на С/С++

<<- Назад к вопросам

<pre> //====================== start of sample.cpp ========================== class User {}; class Bank {} my_bank; class User my_user; class Bank *pMyBank = &amp;my_bank; class Bank&amp; rBank = &amp;my_bank; User *const &amp;prUser = &amp;my_user; User& secondUser = &amp;my_user; //====================== end of sample.cpp ========================== </pre> Какие присвоения и объявления в файле sample.cpp валидны?

(Ответ считается верным, если отмечены все правильные варианты ответов.)

Варианты ответа
my_user(Верный ответ)
rBank
secondUser
mMyBank(Верный ответ)
prUser(Верный ответ)
my_bank(Верный ответ)
Похожие вопросы
<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 ========================== class User { public: struct Region { short country_code; short city_code; static char* city_name; }; const char* name; int age; double balance; Region region; const char* get_name() const { return (*this).name; } int get_age() const { return this-&gt;age; } double get_balance() const { return (*this)-&gt;balance; } short get_country_code() const { return Region::country_code; } short get_city_code() const { return region.city_code; } const char* get_city_name() const { return Region::city_name; } }; //====================== end of sample.cpp ========================== </pre> В каких методах обращения к членам объекта класса user типа User корректны?
<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&amp; in_b); //====================== end of sample.h ========================== </pre> Какие присвоения и объявления в файле sample.h валидны?
<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.cpp ========================== class MyAClass { public: const MyAClass&amp; getMe() const { return *this; } }; MyAClass *myAFactory1 = new MyAClass(); MyAClass myAFactory2; MyAClass *myA1 = myAFactory1-&gt;getMe(); MyAClass myA2 = myAFactory1-&gt;getMe(); MyAClass const &amp;myA3 = myAFactory1-&gt;getMe(); MyAClass &amp;myA4 = myAFactory1-&gt;getMe(); MyAClass const &amp;myA5 = myAFactory2.getMe().getMe(); //====================== end of sample.cpp ========================== </pre> Какие присвоения и объявления в файле sample.cpp валидны?
<pre> //====================== start of sample.cpp ========================== class Program { public: static char* country; static const int version = 5; static short buid_num = 2223; static char* name; static long long date; }; Program prog; //====================== end of sample.cpp ========================== </pre> Какие объявления и обращения к членам класса и объекта prog, типа Program в файле sample.cpp корректны?
<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 ========================== template &lt;typename T&gt; class multiplies: public binary_function&lt;T,T,T&gt; { public: T operator() (const T&amp; x, const T&amp; y) const { return x * y; } }; //====================== end of sample.cpp ========================== </pre> Какие утверждения про приведённый выше код функтора multiplies верны?