October 2011
Beginner to intermediate
1200 pages
35h 33m
English
Student Class ExampleAt this point you need to provide the Student class declaration. It should, of course, include constructors and at least a few functions to provide an interface for the Student class. Listing 14.1 does this, defining all the constructors inline. It also supplies some friends for input and output.
Listing 14.1. studentc.h
// studentc.h -- defining a Student class using containment#ifndef STUDENTC_H_#define STUDENTC_H_#include <iostream>#include <string>#include <valarray>class Student{private: typedef std::valarray<double> ArrayDb; std::string name; // contained object ArrayDb scores; // contained object // private method for scores output std::ostream & arr_out(std::ostream & os) const;
Read now
Unlock full access