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.
Answer Posted / 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 View All Answers
Plese get me a perfect C++ program for railway/airway reservation with all details.
Can destructor be overloaded?
Is this job good for future? can do this job post grduate student?
How to call a non virtual function in the derived class by using base class pointer
What is object and class in oops?
What type of loop is a for loop?
What is the real time example of encapsulation?
State what is encapsulation and friend function?
What is constructor overloading in oop?
What are benefits of oop?
Why multiple inheritance is not possible?
What is oops?what is its use in software engineering?
There are two base class B1,B2 and there is one class D which is derived from both classes, Explain the flow of calling constructors and destructors when an object of derived class is instantiated.
assume the program must insert 4 elements from the key board and then do the following programs.sequential search(search one of the elements),using insertion sort(sort the element) and using selection sort(sort the element).
What is constructor in oop?