Question: We generally prefer low coupling to tight coupling. In the C++ language, a variable can have file scope, class scope, or method scope. That is
We generally prefer low coupling to tight coupling. In the C++ language, a variable can have file scope, class scope, or method scope. That is a variable with file scope is a variable that is declared outside of any class and can be used by any method of a class that is in file. (A file can contain multiple classes.) A variable with class scope would be a variable declared as private in the class. It can be accessed by any method in the class. A variable with method scope is one that is declared inside a method or is a formal parameter. It can be accessed only inside the method. In addition to these three, a variable can also be declared in a class as public. Explain the types of coupling that are possible with each of these types of variables. In your explanation, explain what can good wrong and in what situation that you still may want to use that type of variable scope and coupling.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
