In C ++ use virtual
.cpp file
#ifndef TETES_H
#define TETES_H
class Tetes
{
public:
Tetes();
virtual ~Tetes();
virtual void exibeDados();
protected:
private:
};
#endif // TETES_H
.h file
#include "Tetes.h"
Tetes::Tetes()
{
//ctor
}
Tetes::~Tetes()
{
//dtor
}
.cpp file
#ifndef TETES1_H
#define TETES1_H
class Tetes1 : public Testes
{
public:
Tetes1();
virtual ~Tetes1();
void exibeDados()
{
cout << "Exibe na Tela" << endl;
}
protected:
private:
};
#endif // TETES1_H
.h file
#include "Tetes1.h"
Tetes1::Tetes1()
{
//ctor
}
Tetes1::~Tetes1()
{
//dtor
}
... more class teste2
, test3
with the same function but different its contents.
But it gives an error
undefined reference to Testes::exibeDados()
Where do I reference and how? Is this how to define an abstract class in C ++?