Hi guys, I'm porting over some C++ code that I wrote for Windows where it works fine (Visual C++) but in Mac OS X I'm getting errors. Here's the problem:
Let's say I've got a simple base class as follows:
And then a derived class as follows:
When trying to compile I get an error that says "HandlerType has not been declared". I also tried using the fully qualified name for the HandlerType:
But then I get the error: "struct BaseClass<T>::HandlerType is not a type". If I don't make the classes templates then it works fine. I'm sure there's a really simple solution to this problem that's staring me in the face but I'm new to Mac / GCC programming so any help would be much appreciated!
Cheers.
Let's say I've got a simple base class as follows:
Code:
template <typename T>
struct BaseClass
{
typedef void (*HandlerType) (int);
};
And then a derived class as follows:
Code:
template <typename T>
struct DerivedClass : public BaseClass<T>
{
void Testground (HandlerType Handler)
{
}
};
When trying to compile I get an error that says "HandlerType has not been declared". I also tried using the fully qualified name for the HandlerType:
Code:
struct DerivedClass : public BaseClass<T>
{
void Testground (BaseClass<T>::HandlerType Handler)
{
}
};
But then I get the error: "struct BaseClass<T>::HandlerType is not a type". If I don't make the classes templates then it works fine. I'm sure there's a really simple solution to this problem that's staring me in the face but I'm new to Mac / GCC programming so any help would be much appreciated!
Cheers.