OOP Flashcards
class
template for an object, defining the attributes and behaviours/methods of the objects in the class
attributes/instance variables
data associated with a class
behaviour/methods
functionality of a class: something that it can do or can be done with it
OOP
composed of a number of interacting objects, each of which is responsible for its own data and the operations on that data. Program code creates the objects and allows them to communicate and receive answers. All processing that is carried out in the program is done by the objects
information hiding
when a class cannot directly access the attributes of another class when they are declared private
why are attributes generally private and classes generally public
so classes can use methods belonging to other classes but cannot directly access or change their attributes
constructor
procedure used to create objects in a class
instatiation
the creation and naming of a new object in a particular class
keyword: new
used when declaring a constructor and instantiate a new object in a class
reference (type) variable
named memory location in which you can store information. it holds a pointer or reference to where the object is stored
in a variable reference diagram the circle and rectangle refers to..
circles: reference variables
rectangles: primitive data types
what are messages used for
to examine or change an object’s state
getter messages
written as functions which return an answer
setter messages
written as procedures which can change the state of an object
objects
instances of a class, which have the same structure methods and attributes but their own data.