Thread overview | |||||
---|---|---|---|---|---|
|
September 24, 2005 Get current object in method | ||||
---|---|---|---|---|
| ||||
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 Re: Get current object in method | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tino Schmedemann | 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 Re: Get current object in method | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tino Schmedemann | 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."
|
Copyright © 1999-2021 by the D Language Foundation