0

I'm a beginner to programming.... I when i try to compile this code using visual c++ 2012,Following error shows. 1>e:\item(2).cpp(158): error C3867: 'selection::option': function call missing argument list; use '&selection::option' to create a pointer to member

Please give me a solution

McAden
  • 13,714
  • 5
  • 37
  • 63
user3250106
  • 21
  • 1
  • 1

1 Answers1

2

According to the documentation:-

You tried to take the address of a member function without qualifying the member function with its class name and the address-of operator.

You have to qualify the function name with the class name using :: to get rid of the error:-

You should do this:-

    &className::func1

instead of

    &func1 

But since, you are a beginner, I presume you might have forgotten to supply arguments to your function call.

Pratik Singhal
  • 6,283
  • 10
  • 55
  • 97
  • What made you decide that the OP wants take the address of a member function in the first place? – AnT stands with Russia Jan 29 '14 at 18:46
  • @AndreyT Check the documentation link.Based on the info provided by OP, we can only make a approximate guess what OP is trying to do. – Pratik Singhal Jan 29 '14 at 18:49
  • Documentation at the link applies to error C3867, which was the compiler's guess at what the OP was trying to do. This compiler's guess is most likely completely off the mark. My guess would be that the OP simply forgot to specify arguments in member function call and the complier wildly misinterpreted the situation. I.e. it has nothing to do with any member function pointers at all. – AnT stands with Russia Jan 29 '14 at 19:00
  • @AndreyT I also, guessed the same but then went with the compiler's guess. Anyways edited my answer to include that case also. – Pratik Singhal Jan 29 '14 at 19:05