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;
}

Answers were Sorted based on User's Feedback



what is out put of the following code? #include class Base { Base() { cout<<"const..

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

what is out put of the following code? #include class Base { Base() { cout<<"const..

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 out put of the following code? #include class Base { Base() { cout<<"const..

Answer / anvesh

there is no include file iostream for cout
immproper ending for classes ';'

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

Write a program that his output 1 12 123

0 Answers  


What is the use of pointers in C?

0 Answers   Impetus, Motorola, Tavant Technologies, Virtusa,


How main function is called in c?

0 Answers  


what is the need for main function in c?

5 Answers  


How can I find out if there are characters available for reading?

0 Answers  


Can the curly brackets { } be used to enclose a single line of code?

0 Answers  


Explain what are binary trees?

0 Answers  


dennis ritchie invented C language in AT&T bell laboratory what is the extension of AT&T?

4 Answers  


illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question

0 Answers  


Between macros and functions,which is better to use and why?

0 Answers  


Are enumerations really portable?

0 Answers  


prototype of sine function.

2 Answers   Cadence,


Categories