Visit complete Design and Architecture roadmap

← Back to Topics List

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.

Roadmaps Guides Videos About YouTube

roadmap.sh by Kamran Ahmed

Community created roadmaps, articles, resources and journeys to help you choose your path and grow in your career.

© roadmap.sh · FAQs · Terms · Privacy