Ruby/Metody singletonowe: Różnice pomiędzy wersjami

Usunięta treść Dodana treść
Szymon wro (dyskusja | edycje)
Nowa strona: The behavior of an instance is determined by its class, but there may be times we know that a particular instance should have special behavior. In most languages, we must go to the trou...
 
Kj (dyskusja | edycje)
m nav
Linia 10:
#<SingletonTest:0xbc468>
ruby> test2 = SingletonTest.new
#<SingletonTestSingletonTesModuły|nast=t:0xbae20>
ruby> def test2.size
| 10
Linia 25:
 
Singleton methods are not unique to ruby, as they appear in CLOS, Dylan, etc. Also, some languages, for example, Self and NewtonScript, have singleton methods only. These are sometimes called prototype-based languages.
<noinclude>
{{ProstaNawigacja|spis=Ruby|poprzart=Ruby/Kontrola dostępu|poprz=Kontrola dostępu|nastart=Ruby/Moduły|nast=Moduły}}
</noinclude>