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
inheritance
:
Content language: Русский
English
Скомпилируется ли этот код: struct A : int { };
inheritance
Какой модификатор доступа следует указать для члена класса, если вы хотите, чтобы член класса был доступен только самому классу и классам, наследуемым от него?
inheritance
Что будет выведено на экран? #include <iostream> class A { public: A(void){std::cout << "A";} ~A(void){std::cout << "a";} }; class B : public A { public: B(void){std::cout << "B";} ~B(void){std::cout << "b";} }; int main(void) { B b; return 0; }
inheritance
Может ли чисто виртуальная функция иметь тело?
inheritance
Какие строки кода содержат ошибки? struct A { int a; public: int b; protected: int c; private: int d; }; struct B: public A { int fa() {return a;} //1 int fb() {return b;} //2 int fc() {return c;} //3 int fd() {return d;} //4 };
inheritance
Какой результат компиляции и выполнения следующей программы? #include <iostream> #include <string> struct A { void exec() { std::cout << "Hello "; } }; struct B { void exec() {} }; struct C : virtual A, virtual B { void exec() { A::exec(); std::cout << "World\n"; } }; int main() { A* a = new C(); B* b = new C(); C* c = new C(); a->exec(); b->exec(); c->exec(); }
inheritance
Что будет выведено? #include <iostream> using namespace std; class C { public: void Print() { cout << "CLASS C"; } }; class D : public C { public: void Print() { cout << "CLASS D"; } }; int main() { C *test = new D(); test->Print(); }
inheritance
Откомпилируется ли следующий фрагмент кода: class fullEmpty { }; class iClass: fullEmpty { public: int iPublicVariable; private: float iPrivateVariable; protected: int iProtectedVariable; public: double iPublicVariableToo; };
inheritance
Что будет выведено на экран в результате работы программы? #include <iostream> using namespace std; class Base { public: virtual ~Base() { cout << "Base удален\n"; } }; class Derv: public Base { public: ~Derv() { cout << "Derv удален\n"; } }; int main() { Base *pBase = new Derv; delete pBase; return 0; }
inheritance
Присутствуют ли ошибки в следующей программе? class A {}; class B: A {}; struct C {}; struct D: C {}; int main(void) { A *clA = new B(); //1 B *clB = new B(); //2 C *stC = new D(); //3 D *stD = new D(); //4 delete clA; delete clB; delete stC; delete stD; return 0; }
inheritance
← Prev
1
2
3
4
5
Next →
Sign Up Now
or
Subscribe for future quizzes