Imported Upstream version 2.4.2
[platform/upstream/libtool.git] / tests / tagdemo / main.cpp
1 // -*- C++ -*-
2 //    main.cpp -- tagdemo test program
3 //
4 //    Copyright (C) 1998-2000 Free Software Foundation, Inc.
5 //    Written by Thomas Tanner, 1998
6 //
7 //    This file is part of GNU Libtool.
8 //
9 // GNU Libtool is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License as
11 // published by the Free Software Foundation; either version 2 of
12 // the License, or (at your option) any later version.
13 //
14 // GNU Libtool is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 // GNU General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with GNU Libtool; see the file COPYING.  If not, a copy
21 // can be downloaded from  http://www.gnu.org/licenses/gpl.html,
22 // or obtained by writing to the Free Software Foundation, Inc.,
23 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24
25 #include "foo.h"
26 #include "baz.h"
27 #include "conv.h"
28 #ifdef HAVE_IOSTREAM
29 # include <iostream>
30 #else
31 # include <iostream.h>
32 #endif
33 #ifdef HAVE_NAMESPACES
34 namespace std { }
35 using namespace std;
36 #endif
37
38
39 int
40 main (int, char *[])
41 {
42   cout << "Welcome to GNU libtool tagdemo C++!" << endl;
43
44   foobar_derived FB;
45   // Instantiate the derived class.
46
47   foobar *fb = &FB;
48   // Have some fun with polymorphism.
49
50   int value = fb->hello();
51
52   cout << "foobar::hello returned: " << value << endl;
53   if (value == HELLO_RET)
54     cout << "foobar::hello is ok!" << endl;
55
56   if (fb->foo() == FOO_RET)
57     cout << "foobar::foo is ok!" << endl;
58
59   // --------------
60
61   barbaz_derived BB;
62   // Instantiate the derived class.
63
64   barbaz *bb = &BB;
65   // Have some fun with polymorphism.
66
67
68   // barbaz_derived::baz() should return FOO_RET since it calls
69   // foobar_derived::foo(), which in turn calls ::foo().
70   if (bb->baz() == FOO_RET)
71     cout << "barbaz::baz is ok!" << endl;
72
73   // --------------
74
75   if (convenience())
76     cout << "convenience is ok!" << endl;
77
78   return 0;
79 }