Created
December 26, 2010 23:01
-
-
Save semihozkoroglu/755706 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/ruby | |
class A | |
def initialize(x) | |
self.x = x #self ile x methoduna gönderiyoruz | |
end | |
def x=(x) | |
x[0] = x[0].chr.capitalize #x[0] ifadesi asci dönmekte ve bunu chr ile karaktere ,capitalize ile upper yapmaktayız. | |
@x = x | |
end | |
def x | |
@x | |
end | |
end | |
yeni = A.new "semih" | |
puts yeni.x | |
~ | |
~ | |
~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment