C++
In which o ...
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
In which order are class fields initialized in a class?
In the order of their declaration
In the order of constructor's initialization list
The initialization order is not guaranteed
Explanation
Get an explanation when it's available:
Subscribe
initialization
class
Like
Login in
to like
Comment
Login in
to comment
Share
Tweet
Related Content
Что будет выведено в результате выполнения следующей программы? #include <iostream> using namespace std; class Clazz { int a; const int b; int c; public: Clazz(int a, int b):a(a - 1),b(b),c(a - 2) {} void print() { cout << a << b << c << endl; } }; int main() { Clazz x(5, 10); x.print(); return 0; }
Будет ли создан объект класса в котором нет ни одного конструктора?
Содержатся ли в коде ошибки, которые не позволят коду скомпилироваться? class A { const int a; A() { a = 10; } };
Что будет выведено в терминал в результате работы следующего кода: #include <iostream> using namespace std; const float WEIGHT = 1.0; class A { public: A(); A(int initialCount); float mWeight; int mCount; }; A::A(int initialCount) : mCount(initialCount), mWeight(mCount*WEIGHT) { } int main() { A objA(15); cout<<objA.mWeight<<endl; return 0; }
Что будет напечатано в результате выполнения функции Test()? #include <iostream> class A { public: A() { std::cout << "A()"; } }; void Test() { A a1 = A(), *a2(), &a3(a1); }
C
++
Quiz
Login to learn C++
or
Read more about
C++ Quizzes
Follow CodeGalaxy
Mobile Beta
Send Feedback
Keep exploring
C++ quizzes
int main() { const int* i = int(); // 1 int const* j = int(); //2 int* const k = int(); //3 int* l(); //4 ++i; //5 ++j; //6 ++k; //7 ++*k; //8 ++l; //9 } Откомпилируется ли такой код? Если нет, то в каких строчках будут ошибки компиляции? После стандарта C++14.
Какой результат работы программы? #include <iostream> using namespace std; void f(double) { cout<<"f1"<<endl; } void f(const int ) { cout<<"f2"<<endl; } void f( int & ) { cout<<"f3"<<endl; } void main(void) { int n = 1; double b = 2; f(n); f(b); }
#include <iostream> using namespace std; int &test() { static int a = 3; return a; } int main() { ++++++test(); cout << test() << endl; return 0; } Что выведет cout?
При истинности какого из приведенных высказываний имеет смысл вычитание указателей?
Какое ключевое слово используется для описания пространства имен?
В чем разница между X x; и X x(); ?
Sign Up Now
or
Subscribe for future quizzes
Login in to like
Login in to comment