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
If the size of int data type is two bytes, what is the range of signed int data type?
What is the purpose of clrscr () printf () and getch ()?
What does stand for?
Implement bit Array in C.
What are the disadvantages of c language?
What do you know about the use of bit field?
What is the difference between procedural and declarative language?
Write a program which returns the first non repetitive character in the string?
What will the code below print when it is executed? int x = 3, y = 4; if (x = 4) y = 5; else y = 2; printf ("x=%d, y=%d ",x,y);
HOW TO SOLVE A NUMERICAL OF LRU IN OS ??????
Why structure is used in c?
`write a program to display the recomended action depends on a color of trafic light using nested if statments
What is getch c?
What is a stream in c programming?
FILE *fp1,*fp2; fp1=fopen("one","w") fp2=fopen("one","w") fputc('A',fp1) fputc('B',fp2) fclose(fp1) fclose(fp2)} a.error b. c. d.