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;
}
Answers were Sorted based on User's Feedback
Answer / pooja sonawane
error.
because, there is no header file.
and no ";" is given after the end of classes.
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / 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 |
How many parameters should a function have?
Is c functional or procedural?
What are the functions to open and close file in c language?
What are different types of operators?
what is pointer?
How do you write a program which produces its own source code as output?
What is the difference between volatile and const volatile?
What is the sizeof () operator?
write a program to generate address labels using structures?
What is nested structure in c?
ratio,age,persentage
in linking some of os executables are linking name some of them