what is out put of the following code?
#include
class Base
{
Base()
{
cout<<"constructor base";
}
~Base()
{
cout<<"destructor base";
}
}
class Derived:public Base
{
Derived()
{
cout<<"constructor derived";
}
~Derived()
{
cout<<"destructor derived";
}
}
void main()
{
Base *var=new Derived();
delete var;
}
Answer Posted / kapil
There are 3 errors mainly
first header files are not included
second no semicolon at the end of class
third constructor of class cannot be private
if all these three errors are removed the output will be
constructor base
constructor derived
destructor base
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Explain how many levels deep can include files be nested?
What is the role of && operator in a program code?
What is zero based addressing?
The number of bytes of storage occupied by short, int and long are a) 2, 2 and 4 b) 2, 4 and 4 c) 4, 4 and 4 d) none
How many header files are in c?
What is preprocessor with example?
What is the meaning of typedef struct in c?
How can I make sure that my program is the only one accessing a file?
Function calling procedures? and their differences? Why should one go for Call by Reference?
Why do we use int main instead of void main in c?
Explain what’s a signal? Explain what do I use signals for?
What should malloc() do? Return a null pointer or a pointer to 0 bytes?
What is d'n in c?
Mention four important string handling functions in c languages .
What is a spanning Tree?