Overloading Someclass.new

how would i overload Someclass.new in 1.6.8, i get a NameError: superclass
method ‘new’ is disabled. I know its possible, maybe delegation?

You don’t overload #new; you define #initialize.

-austin
– Austin Ziegler, austin@halostatue.ca on 2003.05.17 at 22:18:25

···

On Sun, 18 May 2003 08:47:06 +0900, loats205 wrote:

how would i overload Someclass.new in 1.6.8, i get a NameError:
superclass method ‘new’ is disabled. I know its possible, maybe
delegation?

austin said:
-You don’t overload #new; you define #initialize.

Normally, but im wanting to control whats returned by new, not define
initialize.

Did you try this?

def Someclass.new()

end

robert

“loats205” loats205@aol.com schrieb im Newsbeitrag
news:20030518193329.20139.00000182@mb-m27.aol.com

···

austin said:
-You don’t overload #new; you define #initialize.

Normally, but im wanting to control whats returned by new, not define
initialize.

robert wrote:
-Did you try this?

···

-def Someclass.new()


  • -end

Yes… i did, and that is when i got the NameError.

Hi,

robert wrote:
-Did you try this?

-def Someclass.new()


  • -end

Yes… i did, and that is when i got the NameError.

Strange.

class Foo
def Foo.new
p 55
super
end
end

works. Could you show us your program that errors?

						matz.
···

In message “Re: overloading Someclass.new” on 03/05/20, loats205 loats205@aol.com writes:

wait, nevermind, i was calling super in a method redefinition, that was dumb,
sorry. Should have aliased it instead.