logo

Crowdly

Browser

Add to Chrome

Об'єктно-орієнтоване програмування

Looking for Об'єктно-орієнтоване програмування test answers and solutions? Browse our comprehensive collection of verified answers for Об'єктно-орієнтоване програмування at vns.lpnu.ua.

Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!

Дано

визначення класів і об’єктів:

class A {

  public:

          int a;

};

class B: public A {

  public:

          int b;

};

class C: public B {

  public:

          int c;

};

class D: public A, public B, public C {

  public:

          int d;

};

A oA;

B oB;

C oC;

D oD;

      Якими будуть розміри об’єктів оA, oB, oC, oD ? (дані

типу int займають 4 байти)

      Записати всі поля об’єктів оA, oB, oC, oD

View this question

Дано

визначення класів і об’єктів:

class C1 {

  public:

          virtual

void f(){}

                 

void DoIt(){}

};

class C2: public C1 {

  public:

                 

void DoIt(){}

};

C1 *a = new C2();

        Написати всі

вірні звертання до того

методу DoIt() об’єкту a, який визначений в класі C1. Відповідь пояснити.

View this question

Поясніть,

що таке «зрізка», або «розщеплення».

View this question

Від

чого залежить кількість таблиць віртуальних методів?

View this question

Які

методи не успадковуються?

View this question

Дано

визначення класів і об’єктів:

class C1 {

          virtual

void f(){}

};

class C2: public C1 {

};

C1 *a = new C2();

      Навести приклади, як в програмі можна

визначити справжній тип об’єкта a.

View this question

Який

вид успадковування «ближче» до композиції: відкрите чи закрите?

View this question

Дано

визначення класів:

class C1 {

  public:

           void

aPolymorphMethod(); //

поліморфний метод

};

class C2: public C1 {

  public:

           void

aMethod();

};

void C1::aPolymorphMethod()

       aMethod();

}

void C2::aMethod(){}

      Виправити помилки у визначенні цих класів,

які роблять неможливим поліморфізм. Відповідь пояснити.

View this question

Дано

визначення класів і об’єктів:

class C1 {

  public:

          int x;

          virtual

void f(){}

};

class C2: public C1 {

  public:

          char x;

};

C1 *a = new C2;

        Написати всі

вірні звертання до того

поля x об’єкту a, яке визначене в класі C1. Відповідь

пояснити.

View this question

Дайте

визначення поліморфного класу.

View this question

Want instant access to all verified answers on vns.lpnu.ua?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome