|
Re: Q) about singleton methods and access control: msg#01154lang.ruby.general
"Bennett, Patrick" wrote .... > > Maybe I'm missing something here, but.... I called it from an instance. > You saw the 'testObj = A.new' - right? No, the call is on the ``class Level'' - for example I get --- in class_meth self = A with self.type = Class in class_meth self is still = A with self.type = Class in an_instance_method self = #<A:0x2789ad8> with self.type = A --- when running --- class A def A.class_meth puts "in class_meth self = #{self} with self.type = #{type}" obj = A.new puts "in class_meth self is still = #{self} with self.type = #{type}" end # versus def an_instance_method puts "in an_instance_method self = #{self} with self.type = #{type}" end end A.class_meth inst = A.new inst.an_instance_method --- > That works(!)... but why? (scratching head) > Why does send bypass access control? Well it does, so just use it ... /Christoph
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Ruby for Windows Problems - BUG??, Yukihiro Matsumoto |
|---|---|
| Next by Date: | Re: Q) about singleton methods and access control, Patrick Bennett |
| Previous by Thread: | RE: Q) about singleton methods and access control, Bennett, Patrick |
| Next by Thread: | Re: Q) about singleton methods and access control, Patrick Bennett |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |