Problem with BCGame.GetHiddenWordLength

I’m having a problem with this lecture. When I try to compile the C3867 pops in and won’t let me compile the code. I’ve checked it again and again but I can’t seem to find the problem.

“Non standard Syntax, use “&” and create a member pointer.”

Thank you for your time.

Can you show me your code?

Hi, I’m having almost the same issue:
C3867 ‘std::basic_string<char,std::char_traits,std::allocator>::length’: non-standard syntax; use ‘&’ to create a pointer to member’
C2440 ‘return’: cannot convert from ‘unsigned int (__thiscall std::basic_string<char,std::char_traits,std::allocator>::* )(void) noexcept const’ to ‘int32’

the code is identical to the one in the videos
int32 FBullCowGame::GetHiddenWordLength() const { return MyWord.length; }

any ideas?

Show me your full code. So I can look what the problem is.

Here you go:

Thanks for taking a look!

I see the problem.

Change int32 FBullCowGame::GetHiddenWordLength() const { return MyWord.length; }
int32 FBullCowGame::GetHiddenWordLength() const { return MyWord.length(); }

I hope that helps.


Thank you very much, indeed it helped!
I’m swithcing to c++ from c# and it’s a bit weird that you have to call this as a method.
Thanks again!

1 Like

Privacy & Terms