MC logo
PrintMe2 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]
#ifndef _PRINTME2_H_
#define _PRINTME2_H_

#include <iostream>
using std::cout;

 * This class is constructed with an integer, which it
 * will print surrounded by [].
class PrintMe2 {
        int num;                // Here is the number.
        // Remember the number.
        PrintMe2(int m) { num = m; }

        // Print the string.
        virtual void print() { cout << "[" << num << "]"; }