Ticket #5477: boost_testcase.txt

File boost_testcase.txt, 994 bytes (added by radha.nitt@…, 12 years ago)

Testcase

Line 
1% xlC -qversion
2C for AIX version 6.0.0.0radhas@peibm116:/remote/us01home5/radhas/test_prog% cat boost_ptr_vec.cpp
3#include <boost/ptr_container/ptr_vector.hpp>
4#include <string>
5#include <iostream>
6using namespace std;
7class animal : boost::noncopyable
8{
9public:
10 virtual ~animal() {}
11 virtual void eat() = 0;
12 virtual int age() const = 0;
13 // ...
14 };
15class mammal:public animal
16{
17public:
18string name;
19mammal(string set_name)
20{
21name=set_name;
22}
23void eat()
24{
25}
26int age() const
27{
28return 1;
29}
30};
31class bird:public animal
32{
33public:
34string name;
35bird(string set_name)
36{
37name=set_name;
38}
39void eat()
40{
41}
42int age() const
43{
44return 1;
45}
46};
47
48class zoo
49{
50 boost::ptr_vector<animal> the_animals;
51public:
52
53 void add_animal( animal* a )
54 {
55 the_animals.push_back( a );
56 }
57};
58
59int main()
60{
61zoo the_zoo;
62the_zoo.add_animal( new mammal("joe") );
63the_zoo.add_animal( new bird("dodo") );
64
65}