1/29
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Object-oriented programming (OOP):
A programming model that focuses on an application’s components and data and the methods to manipulate them.
Class:
Describes a group or collection of objects with common attributes.
Object:
One instance of a class. Sometimes called one instantiation of a class. When a program creates an object, it instantiates the object.
Attributes:
Characteristics that define an object as part of a class.
Class Methods:
Actions that alter, use, or retrieve the attributes.
Is-a relationship:
“My oak desk with the scratch on top is a Desk”
Class’s instance variables:
Data components of a class that belong to every instantiated object, Often called fields.
State:
A set of all the values or contents of a class object’s instance variables.
Every object that is an instance of a class possesses the same
methods.
Class client or class user:
A program or class that instantiates objects of another prewritten class.
The world is full of objects.
A door is an object that needs to be open or closed. But an “open” procedure works differently on different objects, Open a door, Open a drawer, Open a bank account. One “open” procedure can open anything if it gets the correct arguments.
Polymorphism occurs when
the same method name works appropriately for different object types.
Inheritance:
The process of acquiring the traits of one’s predecessors.
Encapsulation:
The process of combining all of an object’s attributes and methods into a single package.
Information hiding (also called data hiding):
Other classes should not alter an object’s attributes.
Declaring a class does not
create any actual objects.
After an object is instantiated
Methods can be accessed using an identifier, a dot, and a method call.
when programmers call the classes they write
user-defined types. More accurately called programmer-defined types. OOP programmers call them abstract data types (ADTs). Simple numbers and characters are called primitive data types.
Set method (also called mutator method):
Sets the values of data fields within the class. No requirement that such methods start with the set prefix. Some languages allow you to create a property to set field values instead of creating a set method.
Get method (also called accessor method):
Purpose is to return a value to the world outside the class. Value returned from a get method can be used as any other variable of its type would be used.
Work method (also called help method, or faciltator):
performs tasks within a class.
private access:
Data cannot be accessed by any method that is not part of the class.
Public access:
Other programs and methods may use the methods that control access to the private data.
Access specifier:
An adjective defining the type of access that outside classes will have to the attribute or method. Also called an access modifier.
Instance method:
Method that works appropriately with different objects. If you create 100 Students and assign grade point averages to each of them, you would need 100 storage locations in computer memory.
this reference:
An automatically created variable. Holds the address of an object. Passes it to an instance method whenever the method is called. Refers to “this particular object” using the method. Implicitly passed as a parameter to each instance method.
Static methods (also called class methods):
Methods for which no object needs to exist.
Nonstatic methods:
Methods that exist to be used with an object.
You can use objects
like you would use any other simpler data type. Pass to an object to a method. Return an object from a method. Use an array of objects.
Some methods do not require a this reference.
A class method instead of an instance method.