------------------------------------------------------------------------------
MC logo
PrintMeLots Class
[^] CSc 220 Home
------------------------------------------------------------------------------
[Introduction] [Boolean and Control] [Functions] [Arrays and Pointers] [Dynamic Arrays] [Array Errors] [Command Array] [Standard Containers] [Structs and Classes] [Automatic Pointer] [Multi-File Programs] [Copying Objects] [Templates] [Inheritance] [Plain C I/O] [Type Odds And Ends] [Plain C Strings] [File I/O]
[Bounded Safe Array] [Bounded Safe Array Driver] [PrintMe Class] [PrintMe2 Class] [PrintMeLots Class] [PrintMeLots2 Class] [PrintMe Test Driver] [Linked List Node Classes] [Linked List Classes] [Linked List Implementation] [Linked List Driver] [Expression Calculator]
printmult.h
#ifndef _PRINTMULT_H_
#define _PRINTMULT_H_

#include <iostream>

/*
 * This class is constructed with an integer, which it
 * will print repeatedly surrounded by [].
 */
class PrintMeLots: public PrintMe {
    private:
        int count;              // Here is the repeat count.
    public:
        // Remember the number.
        PrintMeLots(int num, int cnt): PrintMe(num) { 
                count = cnt;
        }

        // Print the string.
        void print() { 
                for(int m = count; m > 0; m--)
                        PrintMe::print();
        }
};

#endif