computer






 

Question by  celezar (12)

In C++, is global variable an object?

 
+7

Answer by  gyles19 (126)

Not necessarily. A global variable is any variable which can be accessed from anywhere in the program scope. An object is a reference type, not a scope.

 
+7

Answer by  jose96 (28)

A global variable is not an object in C++, a global variable is a variable that can be accessed from any part of your code.

 
+7

Answer by  japratt (1687)

Normally this type of variable is an object in every program that you may run. There may be a few out there that do not but most do support it.

 
+6

Answer by  Hasan72 (572)

In C++ a global variable is not an object. A global variable is a variable that can be accessed from any part of the code. It has an unlimited potential for creating mutual dependencies. The use of global variables makes software harder to read and understand. Undefined variable's function is automatically considered as global variable.

 
+3

Answer by  gigo (1706)

Not in any case: it can be an object if the global type is a class. But unlike in java not everything is an object.

 
You have 50 words left!