//============================================================================== // * Letsch Informatik * www.LetsInfo.ch CH-8636 Wald // Beratung, Ausbildung und Realisation in Software-Engineering //============================================================================== // Project : C++-Kurs @ Sultex Limited // Modul : C++ // Title : Übung 2 "Klasse": Loesung // Author : Thomas Letsch // Tab-Width : 2 /*///=========================================================================== * Description: Klasse implementieren aufgrund applikatorischer Vorgaben. Mit Strings als char-Array arbeiten. Bearbeitung von Arrays aus Objekten. Allozierung auf Stack und Heap vergleichen. Performanceuntersuchung mit inline-Methoden (-> Kompiler-Option: -O2) * History : 02.01.04: Initial Version. 29.10.05: File-Split wegen inline. * Version : $Revision: 1.7 $ $Date: 2007/06/18 18:49:49 $ /*///=========================================================================== // 1 2 3 4 5 6 7 8 //345678901234567890123456789012345678901234567890123456789012345678901234567890 //============================================================================== #ifndef KLASSE_H #define KLASSE_H 1 #include #include #include "StatisticStopWatch.h" using namespace std; // Klassen-Definitionen: // Person: // Eine Person hat einen Namen (20 Char's) und eine Nummer. class Person { enum {NAME_LEN = 20}; public: Person(); Person(int pNr, const char* pName); int getNr(); int getNrInline(); const char* getName(); void setNr(int pNr); void setName(const char* pName); private: int mNr; char mName[NAME_LEN+1]; }; // Funktions-Prototypen: // Ausgabe eines Arrays von Personen-Objekten auf die Konsole. // pPers: Pointer auf erstes Personen-Objekt im Array. // pLen: Laenge des Personen-Arrays. void printPersArr(Person* pPers, int pLen); // Inline-Methoden: inline int Person::getNrInline() { return mNr; } #endif /*KLASSE_H*/