Давайте иметь 3 файла: < /p>
ppersonne.h: < /li>
< /ul>
#include
#include
using namespace std;
struct Personne {
string nom;
string prenom;
int age;
Personne();
Personne(string nom, string prenom, int age);
Personne(Personne const*);
virtual ~Personne();
void set(Personne);
};
< /code>
ppersonne.cpp: < /li>
< /ul>
#include "Personne.h"
Personne::Personne() : nom(NULL) {}
Personne::Personne(string nom0, string prenom0, int age0) :
nom(nom0),
prenom(prenom0),
age(age0)
{}
Personne::Personne(Personne const* copied) :
nom(copied->nom),
prenom(copied->prenom),
age(copied->age)
{}
Personne::~Personne() {}
void Personne::set(Personne copied) {
cout
#include "Personne.h"
int main()
{
cout set(*moi_pointeur);
return 0;
}
< /code>
in main.cpp, строка 8 должна генерировать ошибку компиляции, поскольку она не соответствует подписи функции, объявленной в Personne.h и реализованной в insperne.cpp. Строка 8 использует функцию SET с Personne* вместо Personne As Argram>
Подробнее здесь: https://stackoverflow.com/questions/795 ... t-possible