Object-Oriented Terms
An object has what 3 unique characteristics?
identity: a specific object. state (attributes): The data fields and their values. The variables behavior (procedures): the methods that allow an object to perform some action.
Instantiation
The creation of an object.
Default Constructor
A constructor that takes no arguments.
Instance Variable
A distinct copy of a class' attributes (member variable) defined for an object when it is instantiated. The opposite of static variables.
Access Modifier
A keyword that dictates the accessibility level of classes, variables, and methods. They are what facilitate the encapsulation aspect of object-oriented programming.
Object Oriented Design
A problem-solving methodology that focuses on the interaction with objects
Inheritance
A way of establishing an Is-a relationship between objects. Basically classes, known as subclasses can inherit state (variables) and behavior (functions) from a superclass. This gives rise to a hierarchical type of program.
A class is to ____ as an object is to _____
Abstract, Concrete
Abstract and Concrete Classes
Abstract: A class from which you cannot instantiate objects but rather it is designed to be inherited from. Concrete: A class that is capable to instantiating objects AND being inherited from.
Class User
Also known as a Class client a program or class that instantiates objects of another prewritten class. Basically something that interfaces with a class. via objects.
Object
An instance of a class. Many objects can be made from a class. It can be assigned values to variables outlined in the class and do actions as outlined by the methods (procedures) in the class. Think of a specific cookie made from the cutter mold.
Constructor
An instantiation of an object with the same name as the class. It resembles a method but has no return type.
What are Class Members?
Another name for attributes and procedures respectively.
Encapsulation
Basically using access modifiers to regulate accessibility by hiding and protecting data. Combined with getter and setter methods are used as an interface to access object components.
Data Abstraction
EX: using cout and cin in a common c++ program.
Is-a and Has-a relationships?
Is-a: Pertains to inheritance from another class. Has-a: When a class is using another class and has it as a member.
Procedural Programming
Linear Programming. Code is executed top to bottom.
Destructor
Similar to a constructor except it performs an operation when the object is destroyed. They are especially useful in deallocating stored memory after use in dynamic memory applications.
Alternate names for subclasses are? What about superclasses?
Sub: derived/child/extended class Super: parent or base class.
Static Variable
The actual variables that are shared by all instances of a class. Unlike instance variables, they are NOT copies. Therefore, any single object can alter the value for all other objects.
Class
The blueprint from which you create objects. It is the abstract data type that contains the attributes (variables) and procedures (methods) for your objects. Think of it like a cookie cutter used to mold.
Accessors and Mutators
The getter and setter methods respectively. Together they form the encapsulation aspect of OOP. Accessors return the private fields and thus give a level of access to other classes. Mutators allow you to set private variable values for objects.
Public and Private access
The two most fundamental access modifiers. Public: Allows access outside the class Private: Does NOT allow direct access outside the class. Therefore, private variables and functions can only be accessed indirectly via public getter and setter functions.
Immutable and Mutable Classes
Unchangeable and changeable Classes respectively. A mutable class provides some level of alteration to its state To be immutable on the other hand means the state cannot be changed once it's created. Basically To be immutable the class: - Has all data fields private - No mutator methods - No accessors that return a reference to a mutable data field.
Abstract Data Type
a programmer-defined type. It is implied that the type's data can only be accessed via methods.