Thread overview
Get current object in method
Sep 24, 2005
Tino Schmedemann
Sep 24, 2005
Hasan Aljudy
September 24, 2005
Is there a way to get a reference/pointer to the current object in a method of this object.

I'm a total newbie to D so write slowly :)


September 24, 2005
Hopefully I'm not misreading your question, but do you mean... this, by this object?

By example:

# class Test
# {
#    int foo()
#    {
#       return this.bar();
#    }
#
#    int bar()
#    {
#       return 42;
#    }
# }

If that's not what you mean, could you please clarify?

-[Unknown]


> Is there a way to get a reference/pointer to the current object in a method of
> this object.
> 
> I'm a total newbie to D so write slowly :)
> 
> 
September 24, 2005
Tino Schmedemann wrote:
> Is there a way to get a reference/pointer to the current object in a method of
> this object.
> 
> I'm a total newbie to D so write slowly :)
> 
> 

this

"this" is a keyword that is a "reference/pointer to the current object in a method of this object."