1

I see a C++ function being defined as below:

int virtual inline fun()
{
   return xxx;
}

I wonder what it means? anyone can explain it?

Stargateur
  • 24,473
  • 8
  • 65
  • 91
JustinGong
  • 399
  • 1
  • 4
  • 17

1 Answers1

0

It simply means the code doesn't compile.

Only non-static methods can be virtual. In your example fun is a free function so virtual cannot be applied to it.

bolov
  • 72,283
  • 15
  • 145
  • 224
  • but the function with this form does exit. and I can compile it in my vs2015 successfully. – JustinGong Nov 14 '17 at 11:14
  • @AndrewGong I highly doubt it. There is no way this can compile. – bolov Nov 14 '17 at 13:15
  • unless that is a method, but you haven't shown that in your post. In your post you showed a free function. That can't compile. If the code you are having and the code you are showing differ, that's another problem. And we can't start guessing what your real code is. – bolov Nov 14 '17 at 13:17