I want to derive a class from the main class as shown in the code below. But I am not sure how can I deal with the constructors of both classes.
Expand|Select|Wrap|Line Numbers
- // erasing from map
- #include <iostream>
- #include <string>
- #include <queue>
- #include <stdio.h>
- #include <sstream>
- using namespace std;
- class ma
- {
- ma(string st);
- };
- class sub
- :public ma
- {
- public:
- sub(string a);
- };
- int main ()
- {
- std::string st = "hello";
- queue<sub*> test;
- test.push(new sub(st));
- return 0;
- }
/tmp/ccQvbxR8.o: In function `main':
test.cpp:(.text+0xf6): undefined reference to `sub::sub(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
collect2: ld returned 1 exit status
May someone please help!!
Regards