Come posso migliorare questa libreria generica che utilizzero nei miei programmi?
codice:#ifndef CCONF_H #define CCONF_H #include "object.h" // inheriting class's header file #include "Lib.h" // La classe che eredita da Object e gestisce la conf class CConf : public Object { public: CConf(); ~CConf(); void Load(strings nome); void Save(strings prog_name); char *GetNome(); private: strings nome_file; protected: char* nome_prog; }; #endif // CCONF_Hcodice:#include "CConf.h" // class's header file #include <fstream> // class constructor CConf::CConf() { } // class destructor CConf::~CConf() { } ////////////////////////////////////////////////////// // Virtuale: no // Funzione: Apre un files // Argomenti: il nome del files // Return: - // Eccezioni: - /////////////////////////////////////////////////////// void CConf::Load(strings nome) { nome_file = nome; ifstream in(nome_file.c_str()); in.getline (nome_prog, 30); cout << GetNome() <<endl; in.close(); } ////////////////////////////////////////////////////// // Virtuale: no // Funzione: Salvare i files // Argomenti: - // Return: - // Eccezioni: - /////////////////////////////////////////////////////// void CConf::Save(strings prog_name) { ofstream out(nome_file.c_str()); cout << "Digita il nome del programma (MAX 29 parole)"<<endl; strings nome; cin >> nome; out << nome; out.close(); } ////////////////////////////////////////////////////// // Virtuale: no // Funzione: Restituire il nome // Argomenti: - // Return: il nome del prog // Eccezioni: - /////////////////////////////////////////////////////// char *CConf::GetNome() { return nome_prog; }

Rispondi quotando