1/24
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Object-Oriented Programming (OOP)
A programming methodology that defines objects whose behaviors and interactions accomplish a given task; models real-world entities using objects.
Procedural Programming
Code divided into procedures and functions; works for small programs but hard to manage in large systems due to separation of data and logic.
Advantages of OOP
Less repetition, better organization, encapsulation, cleaner code, easier updates, scalability.
Class
A blueprint or template defining the structure (attributes) and behavior (methods) of objects.
Object (Instance)
A real entity created from a class; has its own data (state) and behaviors (methods).
State
Current values stored in an object’s attributes; can change during program execution.
Behavior
Actions an object can perform, defined by methods.
Attribute
A characteristic or property of an object; defined as fields/instance variables in a class.
Encapsulation
Bundling data (attributes) and methods into a single unit (class) to keep related logic together.
Inheritance
Reuse of code where a subclass acquires properties and methods of a superclass.
Polymorphism
Ability of different object types to respond to the same method call in different ways.
Constructor
Special method with the same name as the class; used to initialize objects; no return type.
Getter and Setter
Methods to read (get) and update (set) private attributes.
Method Signature
Includes method name and parameter types.
Method Overloading
Defining multiple methods with the same name but different parameter lists.
This keyword
Refers to the current object; used to distinguish instance variables from parameters.
Access modifiers
Control visibility of class members: - public: accessible from anywhere; - private: accessible only within the same class; - protected: accessible within the package and subclasses; - no modifier: accessible only within the package.
Static variable
Class-level variable shared among all instances; one copy only.
Static method
Belongs to the class, can be called without creating an object; can only access static members.
Instance variable
Declared in a class but outside any method; each object has its own copy.
Database analogy in OOP
Classes define structure; objects are like records with unique values in each field.