I would like to know how are created the simple types objects (like int, bool, double,..). Is there any constructor called ? And Also, how are they destructed if there is no destructor ?
Asked
Active
Viewed 67 times
-5
-
2Your question shows no research effort at all. A valid question would be, if after your own research you do not understand some specific point. – renefritze Jun 15 '16 at 08:00
-
Oh i m sorry but i searched but i didn't find any answer that's why i ask it here ? Maybe yuo could answer the question ? :) – Benjamin Jun 15 '16 at 08:04
-
2Related: http://stackoverflow.com/q/5113365/315052 and http://stackoverflow.com/q/3803153/315052 and http://stackoverflow.com/q/456310/315052 and http://stackoverflow.com/q/24000710/315052 – jxh Jun 15 '16 at 08:10
2 Answers
0
Variables of type int, bool, double, char, etc. are NOT objects. These types are called primitive types, so no constructor/destructor outside of memory allocation/deallocation. Look them up for more details.

Rita
- 21
- 4
0
They are not objects, in fact they are called primitive types. Global and static variables are zero-initializated by default by the compiler. Local variables usually contain a random value (it's not defined by the standard).

Mattia F.
- 1,720
- 11
- 21