void::speak(); //THE GLOBAL SCOPE HAS NO SPEAK
It’s interpreting this as void ::speak()
where leading an identifier (a name) with ::
indicates to C++, “Look in the global scope of all names”. ::
is the “scope resolution operator”
In the header file, you should just use void speak();
since C++ sees it inside your class declaration and hence knows it’s part of the class.
2
solved Class has no member speak? [closed]