Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Explain the difference between null pointer and void pointer.

1082


What is the difference between pure virtual function and virtual function?

1120


Explain Basic concepts of C language?

1152


Write the Program to reverse a string using pointers.

1019


What are void pointers in c?

995


What is the difference between text and binary i/o?

1050


What is meant by 'bit masking'?

1390


What is the modulus operator?

1208


What is unary operator?

1100


What is the correct code to have following output in c using nested for loop?

1080


What is use of integral promotions in c?

1148


What is the use of header?

1089


How can I avoid the abort, retry, fail messages?

1136


Where define directive used?

1087


Why is it usually a bad idea to use gets()? Suggest a workaround.

1780