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
What is a shell structure examples?
What is difference between structure and union with example?
Differentiate Source Codes from Object Codes
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
What is the use of structure padding in c?
What is the difference between the local variable and global variable in c?
What type is sizeof?
What is the general form of function in c?
Explain what is a static function?
Explain what are compound statements?
How can you find the day of the week given the date?
What is difference between structure and union in c?
What are reserved words with a programming language?
What is adt in c programming?
how should functions be apportioned among source files?