E
Ernesto
Hi everybody:
I have a strange problem.
I'm creating a base class BaseClass that contains several methods that
will be inherited to all the subclasses I will implement.
This is the BaseClass declaration:
class BaseClassArrayList;
class BaseClassDictionary;
class BaseClass
{
public:
BaseClass();
virtual ~BaseClass();
...
...
BaseClassArrayList* GetElementsArrayList();
BaseClassDictionary* GetElementsDictionary();
};
The BaseClassArrayList and the BaseClassDictionary are instantiations
of class templates:
(A). typedef ArrayList<BaseClass> BaseClassArrayList;
(B). typedef Dictionary<String, BaseClass> BaseClassDictionary;
The ArrayList and the Dictionary template classes are inherited from
BaseClass:
template <class TYPE_T>
class ArrayList : public BaseClass
{
...
};
I'm compiling this code using VS.NET.
The issue is that when I compile my code, the compiler raises an error
on (B)saying that the BaseClassDictionary class has been already
defined with "different basic types" (because I added a "class
BaseClassDictionary;" on my BaseClass definition), but the error is
not raised on (A).
Why cannot I compile this?
Thanks in advance
Ernesto
I have a strange problem.
I'm creating a base class BaseClass that contains several methods that
will be inherited to all the subclasses I will implement.
This is the BaseClass declaration:
class BaseClassArrayList;
class BaseClassDictionary;
class BaseClass
{
public:
BaseClass();
virtual ~BaseClass();
...
...
BaseClassArrayList* GetElementsArrayList();
BaseClassDictionary* GetElementsDictionary();
};
The BaseClassArrayList and the BaseClassDictionary are instantiations
of class templates:
(A). typedef ArrayList<BaseClass> BaseClassArrayList;
(B). typedef Dictionary<String, BaseClass> BaseClassDictionary;
The ArrayList and the Dictionary template classes are inherited from
BaseClass:
template <class TYPE_T>
class ArrayList : public BaseClass
{
...
};
I'm compiling this code using VS.NET.
The issue is that when I compile my code, the compiler raises an error
on (B)saying that the BaseClassDictionary class has been already
defined with "different basic types" (because I added a "class
BaseClassDictionary;" on my BaseClass definition), but the error is
not raised on (A).
Why cannot I compile this?
Thanks in advance
Ernesto