Ho questa lib mia:
codice:
 // files : head.h 
#include <string> 
#ifndef HEAD_H 
#define HEAD_H 

   // la struttura delle persona 
   class Persona 
   { 
      private: 
         char* nome;// il nome 
         char* cognome;//il cognome 
         int anno;//anno 
      public: 
         Persona(char*, char*, int); 
         Persona(); 
         char getNome(); 
         char getCognome(); 
         char setNome(char* nm); 
         char setCognome(char* cgn); 
         int setAnno(); 
         int getAnno(int ann); 
   }; 
#endif
codice:
 // files : Princ.cpp 
#include <iostream> 
#include <string> 
#include "head.h" 

using namespace std; 

void main() 
{ 
   cout<<"\n"; 
} 

// ---------------------------------------- 
// Definizioni 
// ---------------------------------------- 
// costruttore vuoto 
Persona::Persona() 
{ 
} 
//costruttore con argomenti 
Persona::Persona(char* nm, char* cgn, int ann=0) 
{ 
nome = nm; 
cognome = cgn; 
anno = ann; 
} 
// ritorna il nome 
char  Persona::getNome() 
{ 
std::cout << nome; 
   return nome; 
} 
// ritorna il cognome 
int Persona::getAnno() 
{ 
   std::cout << anno; 
   return anno; 
} 
// ritorna l'anno di nascita 
char Persona::getCognome() 
{ 
   std::cout << cognome; 
   return cognome; 
} 
// setta il nome 
char  Persona::setNome(char* nm) 
{ 
   nome = nm; 
   return nome; 
} 
// setta il cognome 
int Persona::setAnno(int ann) 
{ 
   anno = ann; 
   return anno; 
} 
// setta l'anno di nascita 
char Persona::setCognome(char* cgn) 
{ 
   cgn = cognome;    
   return cognome; 
}
Ma mi da:
c:\documents and settings\admin\desktop\gest\princ.cpp(31) : error C2440: 'return' : cannot convert from 'char *' to 'char'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
c:\documents and settings\admin\desktop\gest\princ.cpp(35) : error C2511: 'getAnno' : overloaded member function 'int (void)' not found in 'Persona'
c:\documents and settings\admin\desktop\gest\head.h(8) : see declaration of 'Persona'
c:\documents and settings\admin\desktop\gest\princ.cpp(43) : error C2440: 'return' : cannot convert from 'char *' to 'char'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
c:\documents and settings\admin\desktop\gest\princ.cpp(49) : error C2440: 'return' : cannot convert from 'char *' to 'char'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
c:\documents and settings\admin\desktop\gest\princ.cpp(53) : error C2511: 'setAnno' : overloaded member function 'int (int)' not found in 'Persona'
c:\documents and settings\admin\desktop\gest\head.h(8) : see declaration of 'Persona'
c:\documents and settings\admin\desktop\gest\princ.cpp(61) : error C2440: 'return' : cannot convert from 'char *' to 'char'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Ma nn capisco cosa sbaglio?
Sono semplici get e set