FlashKeepers

Computer Science · College · College and University

Object-Oriented Programming, Unit 2: Encapsulation and Access Control

Object-Oriented Programming, unit: Encapsulation and Access Control. Core concepts, terminology, and worked-example cues a college student meets for this unit, building on prior units without repeating them. Front: a term, concept, or short problem cue. Back: the definition, explanation, or answer.

About this set

37 basic cards for College Computer Science. Set 2 of 7 in Object-Oriented Programming. It opens with "What is encapsulation?" and "Why is encapsulation useful?". Study it alongside the other College sets below.

37 cards · basic cards · AI-written, checked twice. Edit anything.

Study this set free Look inside first Get FlashKeepers for iPhone

Opens in your browser, no account. Get the iPhone and iPad app · Android app

What is encapsulation?
Show answerBundling data and methods together while restricting direct access to internal state
Why is encapsulation useful?
Show answerIt protects an object's internal state from unintended interference and misuse
What is access control, in OOP?
Show answerRules determining which parts of a program can access a class's members
What does the 'private' access modifier do?
Show answerRestricts a member's visibility to within its own class only
What does the 'public' access modifier do?
Show answerAllows a member to be accessed from anywhere the object is visible
What does the 'protected' access modifier do?
Show answerAllows access within the class and its subclasses, but not from unrelated code
What is information hiding?
Show answerConcealing internal implementation details from outside code that uses an object
What is a data abstraction, in the context of encapsulation?
Show answerExposing only relevant, essential details of an object while hiding complexity
Why are instance variables commonly made private?
Show answerTo prevent external code from directly modifying an object's state in invalid ways
What is validation logic often placed in, when using encapsulation?
Show answerSetter methods, to ensure only valid values are assigned to instance variables
What is a package (or namespace), in relation to access control?
Show answerA grouping of related classes, sometimes affecting default access visibility
What is coupling, in software design?
Show answerThe degree to which different classes or modules depend on each other's internals
Why does encapsulation reduce coupling?
Show answerIt hides internal details, so other code depends only on a class's public interface
What is an interface's role in supporting encapsulation?
Show answerIt defines what a class can do without revealing how it does it
What is immutability, in object design?
Show answerDesigning an object so its state cannot be changed after creation

22 more cards in the app

Study this set free