sir plz send me a set of questions that been frequently held in written examination during campus selection.
1333Question 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
1452Post New TCS OOPS Interview Questions
How do I stop a linux job?
hi... can anyone help me to make a two-dimensinal arrays in finding the sum of two elements plzzz. thnx a lot...
Explain java coding standards for classes or java coding conventions for classes?
What are jsp and servlets?
What types of shares can a company issue to raise long term funds?
What is the use of try square?
How to count duplicated values in a column in ms sql server?
write script for bitmap image?
How to upload more than 2GB file from External Source to SAP?
Why do you link tables in access?
What is the purpose of polymorphism?
What command manages floating ip addresses in openstack?
Can user-defined object be declared as static data member of another class?
What is the disadvantage of a star topology?
What is ms word example?