The code is this:
#include "stdafx.h"
#include "classeID.h"
#include <iostream>
#include <string>
using namespace std;
int main() {
id label("default", 0);
cout << "Nome: " << label.getName() << "\n";
cout << "Idade: " << label.getIdade() << "\n";
return 0;
}
//arquivo .h----------
#ifndef classeID_H
#define classeID_H
#include <string>
using namespace std;
class id {
private:
string name;
int idade;
public:
id(string n, int i);
~id(void);
string getName();
int getIdade();
private:
void welcome();
};
#endif // !classeID_H
//arquivo de implementação da classe id(classeID.cpp)----------
#include "classeID.h"
#include <iostream>
#include <string>
using namespace std;
id::id(string n, int i) {
welcome();
this->name = n;
this->idade = i;
}
id::~id(void) {
cout << "Objeto label destruido.\n";
system("pause > null");
}
void id::welcome(void) {
cout << "Bem vindo\n";
}
string id::getName() {
return name;
}
int id::getIdade() {
return idade;
}
I use Visual Studio as IDE. The error that it returns to me is LNK2019. I already searched for this mistake and did not understand anything. My question is also how the .h file is associated with the file classID.cpp. Anyway, I only know that I know nothing ...