RB129: Code Snippets
·1 min
Code Examples for RB129 Assessment Worksheet #
- Write a code snippet that exemplifies each concept - #
- Classes and Objects:
- Objects
- Classes
- Object Instantiation
- Instance Variables
- Instance Methods
- Class Variables
- Class Methods
- Instance Methods vs Class Methods
- Setter and Getter Methods
- Using attr_*
- Method Access Control
- Public
- Private
- Protected
- Inheritance
- Class Inheritance
- Interface Inheritance
- Method Lookup Path
- Object Methods
- Variable Scope with Inheritance
- Polymorphism & Encapsulation
- Polymorphism
- Polymorphism Through Inheritance
- Polymorphism Through Duck Typing
- Encapsulation
- Modules
- Mixin Modules
- Namespacing
- Module Methods
- Self
- Inside Instance Methods
- Inside Class Methods
- Inside Class Definitions
- Inside Mixin Modules
- Outside Any Class
- Fake Operators and Equality
- Equivalence
- ==
- equal? and object_id
- ===
- eql?
- Fake Operators
- Comparison Methods
- Right and Left Shift
- Plus
- Element Setters and Getters
- Collaborator Objects