answersLogoWhite

0


Best Answer

Instance variables are not global nor local variables.

Variables in OOP are different from the counter parts in COBOL, FORTRAN, or C.

To define any variable in OOP, it must be defined within a class/struct, at instance or class level (static in C# or shared in VB.NET).

local variables usually referred to those defined within a method (of a class, instance-level or class-level) in OOP (object oriented programming).

global variables, to define one in OOP is difficult and violate the object oriented design principle. However, the singleton design pattern does address this issue.

Singleton pattern guarantees that the same instance (of that class) being the only one lives within your application (and globally accessible to that same instance), and hence the variables defined within this singleton may be treated as "global" variables

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Are instence variable are global or local variable?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Is a global variable a non-local variable?

True, a variable cannot be both global and local. But if a global and a local variable share the same name, the local one will hide the global.


What is a local variable and What statements are able to access a local variable?

A local variable is a variable that can only be called on by the module. Where as a global variable can be called upon by any module. Only statements made inside the same module can call on a local variable.


How can you declare global and local variable in pseudocode?

A local variable is a variable declared inside a construct, such as a class or function, while a global variable is a variable declared outside of any construct.


How do you access global variable from within the main function when the local variable is of the same name?

When you acess a global variable inside main function you must use the same name, because the variable declared as global can be accessed by any function/procedure on the class where it was defined.


What are local variables in Visual BASIC?

A local variable is only available for use in the procedure it was declared in. Most variables are local. Once the procedure ends, the variable is lost, but as the procedure has done its job, that is not a problem. The opposite is a global variable which is declared outside all procedures and is available for use by any of them.A local variable is only available for use in the procedure it was declared in. Most variables are local. Once the procedure ends, the variable is lost, but as the procedure has done its job, that is not a problem. The opposite is a global variable which is declared outside all procedures and is available for use by any of them.A local variable is only available for use in the procedure it was declared in. Most variables are local. Once the procedure ends, the variable is lost, but as the procedure has done its job, that is not a problem. The opposite is a global variable which is declared outside all procedures and is available for use by any of them.A local variable is only available for use in the procedure it was declared in. Most variables are local. Once the procedure ends, the variable is lost, but as the procedure has done its job, that is not a problem. The opposite is a global variable which is declared outside all procedures and is available for use by any of them.A local variable is only available for use in the procedure it was declared in. Most variables are local. Once the procedure ends, the variable is lost, but as the procedure has done its job, that is not a problem. The opposite is a global variable which is declared outside all procedures and is available for use by any of them.A local variable is only available for use in the procedure it was declared in. Most variables are local. Once the procedure ends, the variable is lost, but as the procedure has done its job, that is not a problem. The opposite is a global variable which is declared outside all procedures and is available for use by any of them.A local variable is only available for use in the procedure it was declared in. Most variables are local. Once the procedure ends, the variable is lost, but as the procedure has done its job, that is not a problem. The opposite is a global variable which is declared outside all procedures and is available for use by any of them.A local variable is only available for use in the procedure it was declared in. Most variables are local. Once the procedure ends, the variable is lost, but as the procedure has done its job, that is not a problem. The opposite is a global variable which is declared outside all procedures and is available for use by any of them.A local variable is only available for use in the procedure it was declared in. Most variables are local. Once the procedure ends, the variable is lost, but as the procedure has done its job, that is not a problem. The opposite is a global variable which is declared outside all procedures and is available for use by any of them.A local variable is only available for use in the procedure it was declared in. Most variables are local. Once the procedure ends, the variable is lost, but as the procedure has done its job, that is not a problem. The opposite is a global variable which is declared outside all procedures and is available for use by any of them.A local variable is only available for use in the procedure it was declared in. Most variables are local. Once the procedure ends, the variable is lost, but as the procedure has done its job, that is not a problem. The opposite is a global variable which is declared outside all procedures and is available for use by any of them.

Related questions

Is a global variable a non-local variable?

True, a variable cannot be both global and local. But if a global and a local variable share the same name, the local one will hide the global.


What is a local variable and What statements are able to access a local variable?

A local variable is a variable that can only be called on by the module. Where as a global variable can be called upon by any module. Only statements made inside the same module can call on a local variable.


What is the difference between a static variable a global variable and a local variable?

A static variable is a variable allocated in static storage. A local variable is a variable declared inside a function. A global variable is a variable declared outside of any class or function. Note that local variables and global variables can both be allocated in static storage.


How can you declare global and local variable in pseudocode?

A local variable is a variable declared inside a construct, such as a class or function, while a global variable is a variable declared outside of any construct.


How are global variable different from local variable in Visual BASIC?

A global variable is available for use throughout the program. It is normally declared outside any procedure. A local variable is only available for use in the procedure it was declared in. Most variables are local, but there will be occasions when you want different procedures to be able to use the same variable. This is when you use a global variable.


How do you access global variable from within the main function when the local variable is of the same name?

When you acess a global variable inside main function you must use the same name, because the variable declared as global can be accessed by any function/procedure on the class where it was defined.


What is the implications of misidentifying a local and global variable?

Your program won't work correctly.


What are local variables in Visual BASIC?

A local variable is only available for use in the procedure it was declared in. Most variables are local. Once the procedure ends, the variable is lost, but as the procedure has done its job, that is not a problem. The opposite is a global variable which is declared outside all procedures and is available for use by any of them.A local variable is only available for use in the procedure it was declared in. Most variables are local. Once the procedure ends, the variable is lost, but as the procedure has done its job, that is not a problem. The opposite is a global variable which is declared outside all procedures and is available for use by any of them.A local variable is only available for use in the procedure it was declared in. Most variables are local. Once the procedure ends, the variable is lost, but as the procedure has done its job, that is not a problem. The opposite is a global variable which is declared outside all procedures and is available for use by any of them.A local variable is only available for use in the procedure it was declared in. Most variables are local. Once the procedure ends, the variable is lost, but as the procedure has done its job, that is not a problem. The opposite is a global variable which is declared outside all procedures and is available for use by any of them.A local variable is only available for use in the procedure it was declared in. Most variables are local. Once the procedure ends, the variable is lost, but as the procedure has done its job, that is not a problem. The opposite is a global variable which is declared outside all procedures and is available for use by any of them.A local variable is only available for use in the procedure it was declared in. Most variables are local. Once the procedure ends, the variable is lost, but as the procedure has done its job, that is not a problem. The opposite is a global variable which is declared outside all procedures and is available for use by any of them.A local variable is only available for use in the procedure it was declared in. Most variables are local. Once the procedure ends, the variable is lost, but as the procedure has done its job, that is not a problem. The opposite is a global variable which is declared outside all procedures and is available for use by any of them.A local variable is only available for use in the procedure it was declared in. Most variables are local. Once the procedure ends, the variable is lost, but as the procedure has done its job, that is not a problem. The opposite is a global variable which is declared outside all procedures and is available for use by any of them.A local variable is only available for use in the procedure it was declared in. Most variables are local. Once the procedure ends, the variable is lost, but as the procedure has done its job, that is not a problem. The opposite is a global variable which is declared outside all procedures and is available for use by any of them.A local variable is only available for use in the procedure it was declared in. Most variables are local. Once the procedure ends, the variable is lost, but as the procedure has done its job, that is not a problem. The opposite is a global variable which is declared outside all procedures and is available for use by any of them.A local variable is only available for use in the procedure it was declared in. Most variables are local. Once the procedure ends, the variable is lost, but as the procedure has done its job, that is not a problem. The opposite is a global variable which is declared outside all procedures and is available for use by any of them.


How do you hide local variables in c and give precedence to global variables inside the function?

Hi, I would like to answr the question.So, if you want the to give more precedence to global variables with respect to a local one.Just add a pair of curly braces in the local variable and by doing so u can access global variable.


Analyze the difference among local module-level and global variables and explain how ActiveX DLLs are created?

Local Variable A Local variable is a variable whose scope is limited to the Block of the Subroutine defining it. Private Sub Command1_Click Dim a as integer End Sub Module Level Variable A Module Level variable is a variable whose scope is limited to the Form Module defining it. Public Sub Command1_Click Dim a as integer End Sub Global Level Variable A Global Level variable is a variable whose scope can be limited to the entire project defining it. Private Sub Class_Initialize () Dim a As Integer End Sub


Which operator is allow to access hidden global variable?

The scope resolution operator, ::, overrides local scope and allows access to objects that are hidden due to global to local scope rules.


What is the difference between global variable and extern variable?

Global variables are non-local variables. That is, variables that are not defined in a function or class. They are globally accessible to all code in the same translation unit. External variables are global variables that have external linkage; they are accessible across translation units.