October 2011
Beginner to intermediate
1200 pages
35h 33m
English
To illustrate these ideas of inheritance and dynamic memory allocation, let’s integrate the baseDMA, lacksDMA, and hasDMA classes just discussed into a single example. Listing 13.14 is a header file for these classes. To what we’ve already discussed, it adds a friend function that illustrates how derived classes can access friends to a base class.
Listing 13.14. dma.h
// dma.h -- inheritance and dynamic memory allocation#ifndef DMA_H_#define DMA_H_#include <iostream>// Base Class Using DMAclass baseDMA{private: char * label; int rating;public: baseDMA(const char * l = "null", int r = 0); baseDMA(const baseDMA & rs); virtual ~baseDMA(); baseDMA & operator=(const ...
Read now
Unlock full access