digitalmars.D - Help with a strange error with delegates
- Carotinho <carotinobg yahoo.it> Feb 12 2005
- Manfred Nowak <svv1999 hotmail.com> Feb 12 2005
- Carotinho <carotinobg yahoo.it> Feb 13 2005
Hi! I really cannot get out of this. I've got a class with a constructor declared as: this(int delegate(int, int, int, int, int) dg, int startx, int starty) which is instanciated by another class, with the following statement: player = new attore(&urubamba, 2*tilesize, 2*tilesize); urubamba is a member of this new class which is declared as: int urubamba(int where, int altox, int altoy, int bassox, int bassoy) But when I try to compile, I got the following message: map21.d(170): constructor map21.attore.this (int delegate(int,int,int,int,int)bamboleio,int startx,int starty) does not match argument types (int(*)(int where,int altox,int altoy,int bassox,int bassoy),int,int) map21.d(170): cannot implicitly convert expression #urubamba of type int(*)(int where,int altox,int altoy,int bassox,int bassoy) to int delegate(int,int,int,int,int) Why urubamba is int(*)?and why # and not &? I checked with other encoding, but the result is the same... I really cannot understand... thanks in advance! Carotinho
Feb 12 2005
Carotinho wrote: [...]map21.d(170): constructor map21.attore.this (int delegate(int,int,int,int,int)bamboleio,int startx,int starty) does not match argument types (int(*)(int where,int altox,int altoy,int bassox,int bassoy),int,int)
`ìnt(*)' means that the reference to `urubamba' is a function reference. Seems that line 170 of map21.d is in the body of the other class and not in the body of a function member of the other class. Within the body of the class the reference to `urubamba' is a function reference. Within the body of a function member the reference to `urubamba' is a delegate reference. -manfred
Feb 12 2005
Hi!Within the body of the class the reference to `urubamba' is a function reference. Within the body of a function member the reference to `urubamba' is a delegate reference.
I've understood! Indeed it was a silly error: I accidentally left out urubamba from the class, while editing the file! :) Shame on me:) thanks a lot! Carotinho
Feb 13 2005








Carotinho <carotinobg yahoo.it>