I am trying to learn patterns in C ++ and I have the following code:
#include <stack> template<typename T> class myClass : public std::stack<T>{ public: myClass(void); myClass(myClass const & src); virtual ~myClass(void); myClass & operator=(myClass const & rhs); }; template<typename T> myClass::myClass(void) : std::stack<T>(){ }
But I cannot understand why I get the following when I try to compile:
test.cpp:17:1: error: 'myClass' is not a class, namespace, or enumeration myClass::myClass(void) : std::stack<T>(){ ^ test.cpp:8:9: note: 'myClass' declared here class myClass : public std::stack<T>{ ^ 1 error generated.
It seems that the definition of the function is causing an error, but I donโt know why I get this error, it looks normal to me (even if I assume that it is not completely normal), maybe a syntax error ?.
I am compiling with clang ++ -Wall -Werror -Wextra -c .
What can cause this error?
source share