c++ - Cannot move virtual function outside header -
i have c++ class header defines many functions inline. want move these functions outside header , seperate .cpp
file speeden compile. although can move normal functions seperate file , keep function deceleration in header, when try move virtual functions .cpp
following error:
error 2 - error c2723: 'virtual' storage-class specifier illegal on function definition
how do that? function follows:
virtual void soundmixersub::setfilters(const mixerfilter& f) { .... }
as says, can't have virtual
on function definition outside class, per §7.1.2:
the
virtual
specifier shall used in initial declaration of non-static class member function
keep virtual
on declaration , remove definition. in header file:
class soundmixersub : ... { // ... virtual void setfilters(const mixerfilter&); // ... };
then in implementation file:
void soundmixersub::setfilters(const mixerfilter& f) { // ... }
Comments
Post a Comment