1
In C++ virtual uses
file . cpp
#ifndef TETES_H
#define TETES_H
class Tetes
{
public:
Tetes();
virtual ~Tetes();
virtual void exibeDados();
protected:
private:
};
#endif // TETES_H
file . h
#include "Tetes.h"
Tetes::Tetes()
{
//ctor
}
Tetes::~Tetes()
{
//dtor
}
file . cpp
#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
file . h
#include "Tetes1.h"
Tetes1::Tetes1()
{
//ctor
}
Tetes1::~Tetes1()
{
//dtor
}
... classier teste2
, test3
with the same but different function its content.
But it makes a mistake
undefined reference to Testes::exibeDados()
Where do I have to reference and how? That’s how you define an abstract class in C++?
It was my mistake in typing is not Test is Tests
– Vale
Typos cause problems and your code seems to have several.
– Maniero
when shooting the virtual function displayDates () from the Test works
– Vale
I had forgotten one detail.
– Maniero
now it worked
– Vale