#Ziglings #65

1 messages · Page 1 of 1 (latest)

boreal nacelle
#

I'm trying to understand the error message I get on Ziglings Exercise $65:

exercises/065_builtins2.zig:45:19: note: struct declared here
const Narcissus = struct {
                  ^~~~~~
exercises/065_builtins2.zig:50:5: note: 'fetchTheMostBeautifulType' is not a member function
    fn fetchTheMostBeautifulType() type {

I've tried adding a self parameter, but that doesn't seem to do the trick.

What does it mean that this is "not a member function", if it's a function defined inside the scope of the struct.

kind flint
#

Try to mark the function as pub

cerulean canyon
#

the signature of the function is fine. You need to call it differently.

#

like it says,

    // Oh dear, we seem to have done something wrong when calling
    // this function. We called it as a method, which would work
    // if it had a self parameter. But it doesn't. (See above.)