Please send questions to st10@humboldt.edu .
// PLAYING with items
// 5-3-04

#include <iostream>
#include "flavored_item.h"
#include "stock_item.h"
#include "stack2.h"
using namespace std;

int main()
{
    stack<stock_item> junk;

    stock_item hammer(1, "Ball Peen Hammer", 15, 8.99);
    flavored_item bj(2, "Ben and Jerry's", 200, 2.99, "Cherry Garcia");
    flavored_item checkMe;

    junk.push(hammer);

    // SO --- how can I get away with putting a flavored_item
    //    in a stack of stock_item's??? BECAUSE, as a subclass
    //    of stock_item, an instance of flavored_item is also
    //    considered to be of type stock_item
    junk.push(bj);

    cout << "Does this Ben and Jerry's have flavor Cherry Garcia? " << endl;
    bj.display_item( );

    cout << "playing with items" << endl;
    cout << endl;
    cout << "1==pass, 0==fail" << endl;
    cout << "-----------------------" << endl;

    cout << ((junk.top( )).get_name( ) == "Ben and Jerry's") << endl;

    // sadly, as an array of stock_item's, the C++ compiler will
    //    not accept flavored_item member functions, even though
    //    this happens to BE a flavored_item...

    //cout << ((junk.top( )).get_flavor( ) == "Cherry Garcia") << endl;
    cout << "Is this Cherry Garcia?" << endl;
    junk.top( ).display_item( );
    junk.pop( );


    cout << ((junk.top( )).get_name( ) == "Ball Peen Hammer") << endl;

    // mind you, I am HAPPY that get_flavor isn't considered to be
    //    logical here
    //cout << ((junk.top( )).get_flavor( ) == "") << endl; 

    cout << "Is this Ball Peen Hammer?" << endl;
    junk.top( ).display_item( );

    return EXIT_SUCCESS;
}