Jump to content

Problema com Destrutor Virtual


Recommended Posts

Estou aqui com um problema que nem sequer percebo porque me está a dar, tenho a class Pessoa definida desta maneira:

#include <iostream>

using namespace std;

#include "Data.h"

class Pessoa{


string nome;
Data data_nasc;
float altura;


Pessoa(string n, Data dn, float alt);
Pessoa(const Pessoa& p);
virtual ~Pessoa();
virtual Pessoa* clone() const;

string getNome();
void setNome(string n);
float getAltura();
void setAltura(float alt);
Data getData_nasc();
void setData_nasc(Data dn);


Se compilar assim não dá erro, mas se acrescentar por exemplo a construção do primeiro construtor:


Já me dá erro 👍

Error 1 error LNK2001: unresolved external symbol "public: virtual class Pessoa * __thiscall Pessoa::clone(void)const " (?clone@Pessoa@@UBEPAV1@XZ) c:\Users\renato sousa\documents\visual studio 2010\Projects\Exame_PL1\Exame_PL1\main.obj Exame_PL1


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.