In the file test.cpp, I have this:
template <typename T>
class A
{
public:
A(int a){};
virtual ~A();
private:
};
class B : public A<int>
{
public:
B(int a):A(a){};
virtual ~B();
private:
};
int main()
{
return 0;
}
When I compile it, I get this:
jason@jason-linux:~/Documents/ECLibrary$ g++ -g -Wall -Wextra -pedantic-errors test.cpp -o tdriver
test.cpp: In constructor ‘B::B(int)’:
test.cpp:14: error: class ‘B’ does not have any field named ‘A’
test.cpp:14: error: no matching function for call to ‘A<int>::A()’
test.cpp:5: note: candidates are: A<T>::A(int) [with T = int]
test.cpp:3: note: A<int>::A(const A<int>&)
I do not want a default constructor for my base class, since it doesn't make sense in my code. I just want my derived class to perform the called constructor of the base class and do some extra construction for the extra stuff in the derived class. I'm really not sure why it is trying to call the default constructor of the base class when I'm trying to explicitly call an alternate constructor. Am I missing something here?
Thanks