Yurttas/PL/OOL/Cplusplus/F/08/01/01/00/fruits 14.cpp

 1/*
 2   Copyright(C) 1998
 3   All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4
 5   Permission to use, copy, modify, and distribute this
 6   software and its documentation for EDUCATIONAL purposes
 7   and without fee is hereby granted provided that this
 8   copyright notice appears in all copies.
 9
10   date   : January 1, 1998.
11   authorĀ : Salih Yurttas.
12
13   fruits_14.cpp
14*/
15
16
17#include <iostream>
18#include <vector>
19
20using namespace std;
21
22#include "Apple.h"
23#include "Orange.h"
24
25int main(int argc, char* argv[]) {
26
27  vector<Fruit *> fp;
28  
29  fp.push_back(new Apple);
30
31  fp[0]->set_price(2);
32  cout << fp[0]->identify() << endl;
33  fp[0]->print_price();
34  cout << endl;
35
36  fp.push_back(new Orange);
37
38  fp[1]->set_price(1);
39  cout << fp[1]->identify() << endl;
40  fp[1]->print_price();
41  cout << endl;
42
43}