Home
Ruby
ActiveRecord
Array
CGI
Class
Collections
Database
Date
Design Patterns
Development
File Directory
GUI
Hash
Language Basics
Method
Network
Number
Rails
Range
Reflection
Statement
String
Threads
Time
Tk
Unit Test
Windows Platform
XML
Menu
getter setter « Class « Ruby
Ruby
Class
getter setter
1.
Add a method named get_color, which returns the color of animal objects created from this class:
2.
Call a member method
3.
getter and setter
4.
Accessors
5.
Define getter for a attribute
6.
Make an attribute readable and writable by using attr_reader, attr_writer
7.
Provide the getter
8.
Setter with calculation
9.
Setter with =