Back to Developer Roadmap

Scope Visibility

src/data/roadmaps/software-design-architecture/content/scope--visibility@b-YIbw-r-nESVt_PUFQeq.md

4.0827 B
Original Source

Scope Visibility

Scope visibility refers to the accessibility or visibility of variables, functions, and other elements in a program, depending on the context in which they are defined. In object-oriented programming (OOP), scope visibility is controlled through the use of access modifiers, such as "public," "private," and "protected."

  • Public: A public element can be accessed from anywhere in the program, both within the class and outside of it.
  • Private: A private element can only be accessed within the class in which it is defined. It is not accessible to other classes, even if they inherit from the class.
  • Protected: A protected element can only be accessed within the class and its subclasses.

There are variations of scope visibility based on the programming language, but these are the most common.