Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/python/pyste/tests/basic.h @ 45

Last change on this file since 45 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.2 KB
Line 
1/* Copyright Bruno da Silva de Oliveira 2003. Use, modification and
2 distribution is subject to the Boost Software License, Version 1.0.
3 (See accompanying file LICENSE_1_0.txt or copy at
4 http:#www.boost.org/LICENSE_1_0.txt)
5 */
6#ifndef BASIC_H
7#define BASIC_H
8
9
10#include <string>
11
12namespace basic {
13   
14struct C
15{   
16    // test virtuallity
17    C(): value(1), const_value(0) {}
18    virtual int f(int x = 10)
19    {
20        return x*2;
21    }   
22   
23    int foo(int x=1){
24        return x+1;
25    }
26
27    const std::string& get_name() { return name; }
28    void set_name(const std::string& name) { this->name = name; }
29private:
30    std::string name;
31
32public:
33    // test data members
34    static int static_value;
35    static const int const_static_value;
36   
37    int value;
38    const int const_value;
39
40    // test static functions
41    static int mul(int x, int y) { return x*y; }
42    static double mul(double x, double y) { return x*y; }
43
44    static int square(int x=2) { return x*x; }
45};
46
47inline int call_f(C& c)
48{
49    return c.f();
50}
51
52inline int call_f(C& c, int x)
53{
54    return c.f(x);
55} 
56
57inline int get_static()
58{
59    return C::static_value;
60}
61
62inline int get_value(C& c)
63{
64    return c.value;
65}
66
67}
68
69#endif
Note: See TracBrowser for help on using the repository browser.