Hi,
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.
If I compile the this code I got this error message:
/tmp/ccQvbxR8.o: In function `main':
test.cpp:(.text +0xf6): undefined reference to `sub::sub(std:: basic_string<ch ar, std::char_trait s<char>, std::allocator< char> >)'
collect2: ld returned 1 exit status
May someone please help!!
Regards
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.
Code:
// 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<ch ar, std::char_trait s<char>, std::allocator< char> >)'
collect2: ld returned 1 exit status
May someone please help!!
Regards
Comment