LRTHW: Word Drills Flashcards
class
tell ruby to make a new kind of thing
object
two meanings: the most basic kind of things, and any instance of some thing
instance
what you get when you tell Ruby to create a class
def
How you define a function inside a class
@
inside the functions in a class, @ is the operator for variables in the instance/object being accessed
inheritance
the concept that one class can inherit trains from another class, much ike you and your parents
composition
the concept that a class can be composed of other classes as parts, much like how a car has wheels
attribute
a property classes have that are from composition and are usually variables
is-a
A phrase to say that something inherits from another, as in a Salmon is-a Fish
has-a
A phrase to say that something is composed of other things or has a trait, as in Salmon has-a mouth
class X(Y)
Make a class named X that is-a Y
class X(object def initialize(J)
class X has-a initialize that takes J paramaters
class X(object) def M(J)
class X has-a function named M that takes J parameters
foo = x()
Set foo to an instance of class X
foo.M(J)
from foo get the M function and call it with parameters J