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 |
Who is the main contributor in designing the c language after dennis ritchie?
printf("%d",(printf("Hello")); What it returns?
How can you pass an array to a function by value?
3. Program to print all possible substrings. ex: String S St Str Stri Strin String t tr tri trin tring r
what are the program that using a two dimensional array that list the odd numbers and even numbers separately in a given 10 inputs values
0 Answers College School Exams Tests,
How can I split up a string into whitespace-separated fields?
How can I ensure that integer arithmetic doesnt overflow?
There is a 100-story building and you are given two eggs. The eggs (and the building) have an interesting property that if you throw the egg from a floor number less than X, it will not break. And it will always brake if the floor number is equal or greater than X. Assuming that you can reuse the eggs which didn't broke; you got to find X in a minimal number of throws. Give an algorithm to find X in minimal number of throws.
please give me a VIRTUSA sample palcement papers.... you will only send TECHNICAL SECTION..... that is help for me Advance Thanks........................
ATM machine and railway reservation class/object diagram
why do we use pointer instead directly acessing the data?
which header file contains main() function in c?
17 Answers Google, HCL, TCS,