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;
16 Cards in this Set
- Front
- Back
class |
tell Ruby to create a new type of thing. |
|
object |
the most basic type of thing, and any instance of something. |
|
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 a variable for the instance/object being accessed. |
|
inheritance |
the concept that one class inherits traits from another class, much like you and your parents |
|
composition |
the concept that a class can be composed of other classes as parts, much like how cars have wheels |
|
attribute |
a property a classes have that are from composition and are usually variables |
|
is-a |
A phrase to say that something inherits from another as in 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 |
|
classX(Y) |
Make a class named X that is-a Y |
|
class X(object): def initialize(J) |
Class X has-a initialize with that takes parameter J |
|
class X(object): def M(J) |
Class X has-a function M that takes a parameter J |
|
foo = X() |
set foo to instance of class X |
|
foo.X(M) |
from foo get function X and call it with parameters J |
|
foo.K = Q |
from foo get the K attribute and set it to Q |