What will be printed out as a result of the following code execution?
#include <iostream>

using namespace std;

class A
{
public:
    int a=3;
};
class B:public A
{
public:
    B(){str="Day";}
    ~B(){delete [] str;}
    char *str;
};
int main(void)
{
    A *lol=new A;
    cout<<lol->a;
    B* iop=(B *)lol;
    cout<<iop->str;
    return 0;
}

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes