Quizzes
Site Language: English
Українська
English
Русский
Programming Tests
Login
Sign Up
Programming Tests
Theory
Snippets
Papers
Landing
Android
Prices
FAQ
Cosmo Story
Terms and Conditions
Privacy Policy
Cookies Policy
Send Feedback
order of construction
:
Content language: Русский
English
В зависимости от порядка создания объектов - аргументов переопределенного оператора, что будет выведено на экран в результате выполнения следующего кода? #include <memory> #include <iostream> class SomeObj { public: SomeObj() {} SomeObj(const int& val) : val_(std::make_shared<int>(val)) { std::cout << *val_; } void set(const int& val) { val_ = std::make_shared<int>(val); } friend bool operator&&(const SomeObj&, const SomeObj&); private: std::shared_ptr<int> val_; }; bool operator&&(const SomeObj& lhs, const SomeObj& rhs) { return lhs.val_ && rhs.val_; } int main() { if (SomeObj(1) && SomeObj(2)) { std::cout << 3; } return 0; }
order of construction
Какие из объявлений класса А дадут ошибку компиляции при попытке создать его объект
order of construction
Для даных класов в C++, что выведется на экран? #include<iostream> using namespace std; class A{ public: A(){cout<<"A";} }; class B{ public: B(){cout<<"B";} }; class C{ public: C(){cout<<"C";} }; A a; int main(){ B b; return 1; } C c;
order of construction
Что будет напечатано в результате выполнения функции Test()? #include <iostream> class A { public: A() { std::cout << "A()"; } }; void Test() { A a1 = A(), *a2(), &a3(a1); }
order of construction
Что будет результатом работы программы? #include <iostream> class Clazz { public: int Anton; int Kris; int Denis; Clazz(int a) : Anton(++a) , Denis(++a) , Kris(++a) { } }; int main(int argc, char *argv[]) { static int a; Clazz x(a); std::cout << x.Anton << x.Denis << x.Kris; }
order of construction
← Prev
1
Next →
Sign Up Now
or
Subscribe for future quizzes