1.explicit call for destructor
2.calling function inside a constructor.
3.base *b-new derived
delete b;
4.delete p what it will delete.
5.size of base class and derived class int i,in base class
and int j in derived.
6.int i-20
int main()
{

int i =5;
printf("%d".::i);

{

int i =10;
printf("%d".::i);

}
}
7.object slicing
8.new
9.function overloading(return type).
10.class base()
{

virtuval fun()
{
-----
}
}

class derivied:public base()
{
fun()
{
-----
}
}
int main()
{
derived d;

}

11.how static function will call in C++?

12.default structures are in C++?
13.constructors should be in public .
14.virtuval constructor not exist.
15.multilevel inhritence. destructor order.



1.explicit call for destructor 2.calling function inside a constructor. 3.base *b-new derived del..

Answer / achal ubbott

OK! this is a set of questions. Let me see how far can I go.

1. destructor of a class can be called explicitly as
follows using the object of the class.

sample * p = new sample(/*some arguments*/);
p->~sample(); // explicit call;

3. correct order of destructor call is ~derived() and then
~base().
in case you haven't declared the destructor of base as
virtual then delete base; would cause problems.

cheers

Is This Answer Correct ?    4 Yes 0 No

Post New Answer

More OOPS Interview Questions

the difference between new and malloc

5 Answers   Siemens,


how do you handle yourself when you feel the wald is aganist you

2 Answers  


write a C++ program for booking using constructor and destructor.

0 Answers   HAL,


what is difference b/w object based and object oriented programming language?

18 Answers   Chaitanya, College School Exams Tests, Educomp, IBM, Infosys, Telko,


What is R T T I ?

6 Answers   Ness Technologies,






class CTest { public: void someMethod() { int nCount = 0; cout << "This is some method --> " << nCount; } }; int main() { CTest *pctest; pctest->someMethod(); return 0; } It will executes the someMethod() and displays the value too. how is it possible with our creating memory for the class . i think iam not creating object for the class. Thanks in Advance... Prakash

0 Answers  


IN PROGRAMING LANGAUGE A C++ IS PURELY OBJECT ORIENTED OR NOT?

2 Answers  


Why oops is important?

0 Answers  


how to tackle technical questions

1 Answers  


What exactly is polymorphism?

0 Answers  


How to use CMutex, CSemaphore in VC++ MFC

0 Answers   Persistent, TCS,


I hv a same function name,arguments in both base class and dervied class, but the return type is different. Can we call this as a function overloading? Explain?

3 Answers  


Categories