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 the general form of function in c?
Why c is called procedure oriented language?
What is variable and explain rules to declare variable in c?
write a program fibonacci series and palindrome program in c
0 Answers Aditi Placement Service,
How can I call a function, given its name as a string?
Consider a language that does not have arrays but does have stacks as a data type.and PUSH POP..are all defined .Show how a one dimensional array can be implemented by using two stacks.
int zap(int n) { if(n<=1)then zap=1; else zap=zap(n-3)+zap(n-1); } then the call zap(6) gives the values of zap [a] 8 [b] 9 [c] 6 [d] 12 [e] 15
Does * p ++ increment p or what it points to?
what is the advantage of function pointer
16 Answers CMC, CS, Freshdesk, L&T, LG Soft, Matrix, TCS,
What are the disadvantages of external storage class?
What is "Duff's Device"?
What is the output of the following program #include<stdio.h> main() { int i=0; fork(); printf("%d",i++); fork(); printf("%d",i++); fork(); wait(); }