# What's the difference between virtual void something() and void virtual something()?

## Recommended Posts

sheep19    494
I have seen in my C++ book that the author sometimes uses:
void virtual sayHi() const;

or
virtual void sayHi() const;

What's the difference? (I've seen later that he used virtual void hi() const = 0; to make it pure virtual, could I use void virtual hi() const = 0; ?) If they are the same, which is used more often?

##### Share on other sites
Evil Steve    2017
They're the same, although the virtual keyword almost always comes before the return type. So virtual void foo(); is the usual form.

sheep19    494
Thanks!