Topic :: Destructor





Destructor Interview Questions
Questions Answers Views Company eMail

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.

Tech Mahindra,

1 3813

If TDQs are selfdestructive then why they are used? AND Why TSQs are preferred over TDQs?

IBM,

5 10562

What is virtual destructor? Why?

Agile Software, College School Exams Tests, CSC,

3 6020

What's the diff b/w destructor and garbage collector?

Hoch Technologies,

2 5155

What is non-destructive test and what is the purpose of it?

RRB,

1 2291

what happens if an error occurs in constructor or destructor.

Microsoft,

1 4296

Why are the destructors for base class and derived class called in reverse order when the program exits

HCL,

1793

Destructors CANNOT be implemented in which one of the following?

5532

WHAT IS NON DESTRUCTIVE TEST?PLEASE GIVE ME THE PROCEDURE?

3 4968

what is destructive and non-destructive testing of welding

1285

Why doesn't the .NET runtime offer deterministic destruction

1 1346

Is the lack of deterministic destruction in .NET a problem

1 1323

What happens if an exception is throws from an object's destructor?

Amazon,

650

what is a destructor?

Amazon,

666

What are virtual destructors?

InfoAxon Technologies,

579




Related Topics


Un-Answered Questions { Destructor }

Does .net supports destructors concept?

1694


Question In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest. Question Submitted By :: Sunil Kumar I also faced this Question!! Rank Answer Posted By Re: In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest. Answer # 1 use copy constructors 0 Shanthila There is something to be taken care in destructor, in copy constructor, suppose the memory is assigned to the embedded member object pointer with the parameter passed value, but if some other objects of different class also are pointing to this memory, then if some one deletes the object then this class member pointer object will become dangling, or if the object is not deleted properly then there will be memory leak. Please suggest the design change required to handle or avoid this situation

1719


what are constructors and destructors?

1785


what mean void creat_object?in public class in this code class A{ public: int x; A(){ cout << endl<< "Constructor A";} ~A(){ cout << endl<< "Destructor A, x is\t"<< x;} }; void create_object(); void main() { A a; a.x=10; { A c; c.x=20; } create_object(); } void create_object() { A b; b.x=30; }

2131


Always declare destructors to be virtual"?????? why this is so needed?????

1566






Why is it so that we can have virtual constructors but we cannot have virtual destructors?

3989


what is the difference between C and C++? what is the difference between scanf and gets? what is mean by extern what is the use of it? what will happen if i say delete this> Difference between C structure and C++ structure? What is the difference between overloading and overridding? Explain the need for "virtual Destructor" Can we have "virtual Constructors"? What is the different types of polymorphism> What is virtual functions? How to implement virtual function in "C"? What are the different types of storage classes?

1771


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.

1533


Why are the destructors for base class and derived class called in reverse order when the program exits

1793


Destructors CANNOT be implemented in which one of the following?

5532


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

2106


What happens if an exception is throws from an object's destructor?

650


what is a destructor?

666


What are virtual destructors?

579


What is the purpose of a constructor? Destructor?

768