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
any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above
Do string constants represent numerical values?
What is volatile variable in c with example?
Can we initialize extern variable in c?
Who is the founder of c language?
When should a far pointer be used?
I need previous papers of CSC.......plz help out by posting them.......
Linked list is a Linear or non linear explain if linear how it working as a non linear data structures
What is calloc in c?
Explain what is the use of a semicolon (;) at the end of every program statement?
How do you define a string?
When should the register modifier be used? Does it really help?
What is structure in c language?
Why string is used in c?
What is c language used for?