Created
October 20, 2014 20:39
-
-
Save xander-miller/1a68215e2d9a5b4e9101 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class President | |
| attr_accessor :name, :age | |
| def initialize(name, age) | |
| @name, @age = name, age | |
| end | |
| def citizenship | |
| self.class.citizenship | |
| end | |
| end | |
| class UnitedStatesPresident < President | |
| def self.citizenship | |
| "The United States of America" | |
| end | |
| end | |
| class FrancePresident < President | |
| def self.citizenship | |
| "La France" | |
| end | |
| def age | |
| "#{super}, #{catchphrase}" | |
| end | |
| def name | |
| "#{super}, #{catchphrase}" | |
| end | |
| def citizenship | |
| "#{super}, #{catchphrase}" | |
| end | |
| def catchphrase | |
| "bien sur" | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment