Prepare
Practice
Interview
Aptitude
Reasoning
English
GD
Placement papers
HR
Current affairs
Engineering
MCA
MBA
Online test
Login
Online Practice Test
>
CPP 3
« Previous
Next »
Which of the following is a valid destructor of the class name "Country"?
Options
- int ~Country()
- void Country()
- int ~Country(Country obj)
- ~Country()
CORRECT ANSWER : ~Country()
Discussion Board
C++ - Destructors
The correct answer is ~Country(). Destructor has the same name as the class prefixed with a tilde(~) sign. Destructor is a type of special member function of a class and. It is used to destroy the memory allocated by the constructor. It is called automatically by the compiler when the object goes out of scope.
Prajakta Pandit 01-25-2017 06:09 AM
No, all reponses are wrong!!
The constructor must not be signed with the "void"
The right response is Country(); just remove the "void"
Yves 07-13-2015 06:46 AM
destructor
destructor can defined for before datatype
d.janani 12-6-2014 04:33 AM
Comment
constructors and destructors do not have return types. It cannot be even void. The correct answer is missing.
manohar singh 01-30-2014 06:23 AM
Void
The destructor doesn't use "void".
Alexandre Thibodeau 12-15-2013 12:21 PM
« Previous
Next »
Write your comments
*
*
Email must be in the form someone@domain.com
*
*
Enter the code shown above:
Please enter the code shown above
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)
Related Content
C test (42)
C (12)
C++ for beginners (10)
C++ (20)
C++ (24)
C++ (18)
C++ (14)
C++ (12)
C++ (15)
C++ (15)
Data structure (20)
Data structure (10)
Data structure (10)
Data structure (10)
PERL (25)
VC++ (11)
Oops (30)
Mainframe (41)
Mainframe (15)
Embedded systems (15)
OOAD (49)
Advertisement
▲