www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Get current object in method

reply Tino Schmedemann <Tino_member pathlink.com> writes:
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 :)
Sep 23 2005
next sibling parent "Unknown W. Brackets" <unknown simplemachines.org> writes:
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 :)
 
 

Sep 23 2005
prev sibling parent Hasan Aljudy <hasan.aljudy gmail.com> writes:
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."
Sep 24 2005