C++
Which acce ...
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
Which access modifier should the class be defined with for its member to be available only to the class itself and the classes that inherit from it?
public
private
protected
friend
Explanation
Get an explanation when it's available:
Subscribe
class
inheritance
access modifiers
Like
Login in
to like
Comment
Login in
to comment
Share
Tweet
Related Content
Откомпилируется ли следующий фрагмент кода: class fullEmpty { }; class iClass: fullEmpty { public: int iPublicVariable; private: float iPrivateVariable; protected: int iProtectedVariable; public: double iPublicVariableToo; };
Какие из приведенных утверждений являются верными?
Что нужно изменить, чтобы данный код скомпилировался? class A{}; class B: A{}; void foo(A&a) {} int main(int argc, char* argv[]) { B b; foo(b); return 0; }
В каких из перечисленных строк произойдут ошибки компиляции: class Base { public: void method1(); protected: void method2(); private: void method3(); }; class Child : public Base { protected: void method1() { } void method2() { } void method3() { } }; int main() { Base* base = new Child(); base->method1(); // 1 base->method2(); // 2 base->method3(); // 3 return 0; }
Что будет выведено на экран? #include <iostream> class A { public: virtual void f() { std::cout << "A"; } }; class B : public A { private: void f() { std::cout << "B"; } }; void g(A& a) { a.f(); } int main () { B b; g(b); }
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