codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
module UsefulFeatures def class_name self.class.to_s end end class Person include UsefulFeatures end x = Person.new p x.class_name # if you want the method on Person too, you’ll # have to extend class Person extend UsefulFeatures end # could have done this, too: Person.extend UsefulFeatures p Person.class_name
Private
[
?
]
Run code
Submit