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
Where static variables are stored in c?
What are pragmas and what are they good for?
What is the correct declaration of main?
How many types of errors are there in c language? Explain
Explain how can I open a file so that other programs can update it at the same time?
How can I trap or ignore keyboard interrupts like control-c?
What do you mean by keywords in c?
In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)
An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above
How do I round numbers?
What is pre-emptive data structure and explain it with example?
What is the scope of local variable in c?
What is a pointer in c?
What does & mean in scanf?
What's the difference between constant char *p and char * constant p?