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
a number whose only prime factors are 2,3,5, and 7 is call humble number,,write a program to find and display the nth element in this sequence.. sample input : 2,3,4,11,12,13, and 100.. sample output : the 2nd humble number is 2,the 3rd humble number is 3,the 4th humble number is ,the 11th humble number is 12, the 12th humble number is 14, the 13th humble number is 15, the 100th humble number is 450.
What is difference between structure and union with example?
Explain how can a program be made to print the name of a source file where an error occurs?
How can I find the modification date of a file?
cin.ignore(80, _ _);This statement a) ignores all input b) ignores the first 80 characters in the input c) ignores all input till end-of-line d) iteration
any limit on the number of functions that might be present in a C program a) max 35 functions b) max 50 functions c) no limit d) none of the above
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none
swap 2 numbers without using third variable?
What are the different file extensions involved when programming in C?
What is Dynamic memory allocation in C? Name the dynamic allocation functions.
What is a wrapper function in c?
What is the difference between a function and a method in c?
What is the size of empty structure in c?
Here is a good puzzle: how do you write a program which produces its own source code as output?