What does object-oriented programming organize software around?
Object-oriented programming organizes software around objects that combine data with the operations that use or protect that data.
Study 1 Object-Oriented Programming Foundations with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
What does object-oriented programming organize software around?
Object-oriented programming organizes software around objects that combine data with the operations that use or protect that data.
How does a class differ from an object?
A class is a definition or blueprint; an object is a concrete instance created from that class, with its own state.
What is an object's state?
An object's state is the information stored in it at a particular time, such as a bank account's identifier and current balance.
What is an object's behavior?
An object's behavior is the work it can perform, usually exposed through methods such as deposit() and withdraw().
What is encapsulation?
Encapsulation bundles state and behavior while controlling access to internal details, protecting invariants and allowing implementation changes without changing callers.
What does an invariant represent in OOP?
An invariant is a condition that must remain true. Encapsulation helps protect it by preventing invalid direct changes to an object's state.
What relationship does inheritance represent?
Inheritance lets a subclass reuse and specialize a superclass. It represents an “is-a” relationship when the subtype conforms to the base type's promises.
What does polymorphism allow common code to do?
Polymorphism lets common code use objects through a shared type while each object's actual type supplies the appropriate operation implementation.
What does an interface define?
An interface defines a contract: operations that an implementing class promises to provide, without prescribing every implementation detail.
What is composition in object-oriented design?
Composition builds a class from objects of other classes as parts. It represents a “has-a” relationship and can delegate work to those components.
What does programming to an abstraction mean?
Programming to an abstraction means client code depends on an interface or abstract type rather than a particular concrete implementation.
What makes a class cohesive?
A cohesive class has a focused purpose and closely related responsibilities rather than combining unrelated concerns.