import source from 1.3.40
[external/swig.git] / Examples / test-suite / cpp_nodefault.i
1 // This file tests SWIG pass/return by value for
2 // a class with no default constructor
3
4 %module cpp_nodefault
5
6 %inline %{
7
8 class Foo {
9 public:
10    int a;
11    Foo(int x, int y) { }
12   ~Foo() {}
13 };
14
15 Foo create(int x, int y) {
16     return Foo(x,y);
17 }
18
19 typedef Foo Foo_t;
20
21 void consume(Foo f, Foo_t g) {}
22
23 class Bar {
24 public:
25     void consume(Foo f, Foo_t g) {}
26     Foo create(int x, int y) {
27         return Foo(x,y);
28     }
29 };
30
31
32 %}
33
34 %{
35 Foo gvar = Foo(3,4);
36 %}
37
38 Foo gvar;
39
40