What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
class A
{
public:
virtual A(){
cout<<"A's Constructor\n";
}
};
class B: public A
{
public:
A(){
cout<<"Present inside the class B\n";
}
};
int main(int argc, char const *argv[])
{
A a;
return 0;
}
#include <iostream>
#include <string>
using namespace std;
class A
{
public:
virtual A(){
cout<<"A's Constructor\n";
}
};
class B: public A
{
public:
A(){
cout<<"Present inside the class B\n";
}
};
int main(int argc, char const *argv[])
{
A a;
return 0;
}A. A's Constructor
B. Present inside the class B
C. Error
D. Segmentation fault
Answer: Option C

Join The Discussion