Breymann. C++ Einführung und professionelle Programmierung

Breymann. C++ Einführung und professionelle Programmierung Breymann. C++ Einführung und professionelle Programmierung

vred.bioinf.uni.sb.de
von vred.bioinf.uni.sb.de Mehr von diesem Publisher
17.11.2014 Aufrufe

Zuweisungsoperator Vektor& operator=(const Vektor&); // Initialisierung des Vektors void init(const T&); // Zeiger auf Anfang und Position nach dem Ende // für nicht-konstante und konstante Vektoren T* begin() { return start;} T* end() { return start + xDim;} const T* begin() const { return start;} const T* end() const { return start + xDim;} protected: // für Zugriff abgeleiteter Klassen int xDim; // Anzahl der Datenobjekte T *start; // Zeiger auf Datenobjekte }; Breymann C++, c○ Hanser Verlag München Inhalt ◭◭ ◭ ◮ ◮◮ 382 zurück Ende

noch fehlende Implementierungen: // Konstruktor template inline Vektor::Vektor(int x = 0) : xDim(x), start(new T[x]) { } // Kopierkonstruktor template inline Vektor::Vektor(const Vektor &v) { xDim = v.xDim; start = new T[xDim]; for(int i = 0; i < xDim; ++i) start[i] = v.start[i]; } Breymann C++, c○ Hanser Verlag München Inhalt ◭◭ ◭ ◮ ◮◮ 383 zurück Ende

noch fehlende Implementierungen:<br />

// Konstruktor<br />

template<br />

inline Vektor::Vektor(int x = 0)<br />

: xDim(x), start(new T[x]) {<br />

}<br />

// Kopierkonstruktor<br />

template<br />

inline Vektor::Vektor(const Vektor &v) {<br />

xDim = v.xDim;<br />

start = new T[xDim];<br />

for(int i = 0; i < xDim; ++i)<br />

start[i] = v.start[i];<br />

}<br />

<strong>Breymann</strong> <strong>C++</strong>, c○ Hanser Verlag München<br />

Inhalt ◭◭ ◭ ◮ ◮◮ 383 zurück Ende

Hurra! Ihre Datei wurde hochgeladen und ist bereit für die Veröffentlichung.

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!