List two occasions when you might consider declaring variables and constants globally.
What will be an ideal response?
You might consider declaring variables and constants globally:
1. If a data item will be needed in many methods throughout a program, some programmers approve of declaring it globally. For example, if a mathematical program contains many methods that require a constant for a value such as pi, or a business program contains many methods that require a standard tax or discount rate, many programmers would allow these to be declared globally.
2. When you learn about object-oriented programming and create a class from which you will derive objects, you can declare the class's data fields at the class level.
You might also like to view...
Illustrate how a curve’s polynomial degree and fit tolerance can be modified.
What will be an ideal response?
Context switch is the process of saving or restoring a thread's state.
Answer the following statement true (T) or false (F)
The following sentence is punctuated correctly.? The new video game is in the store, however, we cannot sell it before the release date.
Answer the following statement true (T) or false (F)
In designing a worksheet, visual aesthetics should come first.
Answer the following statement true (T) or false (F)