logo

Crowdly

#define main1 main /** Klausimas   Ką atspausdins programa? Jeigu programa nes...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

#define main1 main

/** Klausimas  

Ką atspausdins programa? Jeigu programa nesikompiliuoja, rašykite ERROR į atsakymo langelį.

*/

#include <iostream>

/////////////////////////////////////////////////////// 

class A

{

protected:

int _x;

public:

A(int x = 1): _x(x) { std::cout << "A+"; }

  virtual void rasyk() { std::cout << "A:" << _x << "eA";  }

};

class B: public A

{

private:

      int _y;

public:

      B(int x = 1, int y = -1):A(x), _y(y) { std::cout << "B+"; }

      void rasyk() { std::cout << "B:" << _x << _y << "sB"; }

      void setXY(int x, int y = 13){  _x = x; _y = y; } 

};

int main1()

{

A* as[2];

A a(31);

B b(6);

as[0] = &a; as[1] = &b; 

        b.setXY(8); 

for(int i=0; i<2;i++)

   as[ i ]->rasyk();

}

More questions like this

Want instant access to all verified answers on emokymai.vu.lt?

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