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 |
What is difference between structure and union in c programming?
2. What does static variable mean?
What are different types of pointers?
hello friends what do u mean by BUS ERROR i got this error while i am doing my program in DATA STRUCTURES
code for inverse a matrix
Write a C program to print 1 2 3 ... 100 without using loops?
What is the difference between realloc() and free()
main() { enum{red,green,blue=6,white}; pf("%d%d%d%d", red,green,blue,white); return 0; } a)0 1 6 2 b)0 1 6 7 c)Compilation error d)None of the above
Which are low level languages?
what is the stackpointer
Why c is called a middle level language?
Can we compile a program without main() function?