digitalmars.D.learn - opCall() in structures
- Jesse Phillips (16/16) Dec 09 2007 Trying out the example code for opCall and I get a linker error in linux...
- Mike (11/27) Dec 09 2007 On Sun, 09 Dec 2007 21:42:44 +0100, Jesse Phillips =
- Jesse Phillips (3/35) Dec 09 2007 Yeah, good idea, thanks.
Trying out the example code for opCall and I get a linker error in linux. (dmd 1.024) struct F { int opCall(); int opCall(int x, int y, int z); } void test() { F f; int i; i = f(); // same as i = f.opCall(); i = f(3,4,5); // same as i = f.opCall(3,4,5); } void main() { test() }
Dec 09 2007
On Sun, 09 Dec 2007 21:42:44 +0100, Jesse Phillips = <jessekphillips gmail.com> wrote: You need to have the function bodies somewhere too of course: struct F { int opCall() { return 42; } } -MikeTrying out the example code for opCall and I get a linker error in lin=ux.(dmd 1.024) struct F { int opCall(); int opCall(int x, int y, int z); } void test() { F f; int i; i =3D f(); // same as i =3D f.opCall(); i =3D f(3,4,5); // same as i =3D f.opCall(3,4,5); } void main() { test() }-- = Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Dec 09 2007
On Sun, 09 Dec 2007 22:02:53 +0100, Mike wrote:On Sun, 09 Dec 2007 21:42:44 +0100, Jesse Phillips <jessekphillips gmail.com> wrote: You need to have the function bodies somewhere too of course: struct F { int opCall() { return 42; } } -Mike(3,4,5); // same as iTrying out the example code for opCall and I get a linker error in linux. (dmd 1.024) struct F { int opCall(); int opCall(int x, int y, int z); } void test() { F f; int i; i = f(); // same as i = f.opCall(); i = fYeah, good idea, thanks.= f.opCall(3,4,5); } void main() { test() }
Dec 09 2007