• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/17

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

17 Cards in this Set

  • Front
  • Back
data hiding
making class members unavailable to programs

do this to get the extra variables out of the way

normally if a class is programmed correctly, all interaction should be through methods rather than fields. this helps when changing the way the class works without without changing the actions
scope resolution operator
the operator "::" in "ret_type class::function()"

tells compiler that 'function' of return type 'ret_type' is a method in 'class'

this trick allows programmer to define a method outside the class definition, conditional on the method having been declared within the class definition
constructor
function that initialises a class instance and allocates memory for it

its name is same as the class whose objects it constructs
destructor
function that deletes memory for a class instance when it goes out of scope

its name is same as constructor, with '~' in front

DON'T FORGET TO DEALLOCATE ALL MEMORY WITH THIS GUY
containership
when a class contains other class(es)

advantage: consider class Car, containing classes Wheel, Gear, Engine.
consider a Car object. If a gear were to be changed, you would simply have to assign a corresponding new Gear object to the car. you wouldn't need to create a whole new Car object.
inheritance/derivation
when a class contains all the fields and methods of another class

not the same as containing another class!

eg a batmobile derives from a car hence inherits its fields and methods; a car contains a wheel and so has a Wheel object as a field

syntax: "class Batmobile : public Car {...}"
scope resolution operator within a derived class
this is when it gets really handy: if within Batmobile class you want to make use of a Car method called 'function', you would type "Car::function()"
UML
unified modelling language
attribute
==field, data field, member
operations
==method, member function, member routine

if an operation involves multiple objects, assign it to the one who performs the action
association: define, give UML representation
denotes a relationship between 2 classes

can be multiple associations between classes, eg Person has the "colleague" association to itself, and also "friend"

in UML, represented as an edge between two class nodes
association::role
define, give UML representation
in an association between 3 classes, each class plays a role.

in UML, represented by endpoint of an association edge; description of role is labelled below intersection of edge and node
association::multiplicity
define, give examples, give IML representation
when an association involves a class with multiple instances of the associated class

eg Child involves 2 instances of Parent
eg Company involves 0...* employees

in UML, labelled above intersection of edge and node, above role label
association::aggregation
define, give examples, give UML representation
association in which a class is contained in another

eg Wheel composes (among others) Car

in UML, represented as diamond-tipped directed edge
aggregation::element
aggregation::aggregate
if A is contained in B, B is the element and A is the aggregate in the aggregation
aggregation::shared aggregation: define using 'element' and 'aggregate', give example
aggregation in which element can belong to multiple aggregates - i.e. element is shared between multiple aggregates

eg a department contains students, but a student can belong to multiple departments, so there is shared aggregation from Student to Department
aggregation::composition
aggregation in which element belongs to at most one aggregate

so composition = ¬shared_aggregation