Reputation: 125
#AL.hpp
template <typename A>
class AL
{
public:
void print(A *source, A *dest, unsigned int size);
private:
A *data;
unsigned int size;
unsigned int capacity;
}
namespace {
template <typename A>
unsigned int size s_size = 20;
void print(A *source, A *dest, unsigned int size)
{
....
}
}
template <typename A>
AL<X>& AL<X>::push(A input)
{
capacity *= 2;
A *new_data = new A[capacity];
print(data, new_data, size);
}
I am just wondering how to format this (please don't mind the code). When I run my full code, it says that A is not defined in the namespace. I'm not sure how to pass in the class template to my namespace.
Upvotes: 0
Views: 96
Reputation: 351
#AL.hpp
template <typename A>
class AL
{
public:
AL(A array_list);
AL(const AL& other);
AL& operator=(const AL& other);
~AL;
void print(A *source, A *dest, unsigned int size);
}
namespace {
unsigned int size s_size = 20;
template <typename A>
void print(A *source, A *dest, unsigned int size)
{
....
}
}
If the problem or error is your 'print' function is seemed unnamed then this is the solution.I hope this will help.
Upvotes: 1