Call different member functions on object sequence with a generic handler function?
Ali Çehreli
acehreli at yahoo.com
Sat Jun 30 00:21:48 UTC 2018
On 06/29/2018 02:11 PM, Timoses wrote:
> .... How would one print the address of the object then though?
> Since &a is the address of the reference' types stack location.
Casting the reference to void* produces the address of the object:
import std.stdio;
class C {
int i;
}
void main() {
auto r = new C();
writeln("Reference is at ", &r);
writeln("Object is at ", cast(void*)r);
writeln("Member is at ", &r.i);
}
Sample output:
Reference is at 7FFE735E6698
Object is at 7F78F02B0060
Member is at 7F78F02B0070
Ali
More information about the Digitalmars-d-learn
mailing list