www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How to define struct with function pointer member ?

reply "Gabi" <galim120 bezeqint.net> writes:
I tried:

struct X
{
..
function double(Individual) someFun;
..
}

But get:
Error: Declaration expected, not 'function'


Thanks,
Gabi
Jul 28 2013
next sibling parent "Gabi" <galim120 bezeqint.net> writes:
On Sunday, 28 July 2013 at 22:04:57 UTC, Gabi wrote:
 I tried:

 struct X
 {
 ..
 function double(Individual) someFun;
 ..
 }

 But get:
 Error: Declaration expected, not 'function'


 Thanks,
 Gabi
Sorry I found the answer. Should have declared double function(...) someFun;
Jul 28 2013
prev sibling parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Mon, Jul 29, 2013 at 12:04:55AM +0200, Gabi wrote:
 I tried:
 
 struct X
 {
 ..
 function double(Individual) someFun;
[...] The correct syntax is: double function(Individual) someFun; T -- Music critic: "That's an imitation fugue!"
Jul 28 2013
parent "Gabi" <galim120 bezeqint.net> writes:
On Sunday, 28 July 2013 at 22:13:13 UTC, H. S. Teoh wrote:
 On Mon, Jul 29, 2013 at 12:04:55AM +0200, Gabi wrote:
 I tried:
 
 struct X
 {
 ..
 function double(Individual) someFun;
[...] The correct syntax is: double function(Individual) someFun; T
Yes thanks. Beginner's mistake :)
Jul 28 2013