Commit 857771c7 authored by Robert Bradshaw's avatar Robert Bradshaw

Nested class tests.

parent f9068f3d
# tag: cpp
cdef extern from "cpp_nested_classes_support.cpp":
cdef cppclass A:
cppclass B:
int square(int)
cppclass C:
int cube(int)
B* createB()
def test():
"""
>>> test()
"""
cdef A a
cdef A.B b
assert b.square(3) == 9
cdef A.B.C c
assert c.cube(3) == 27
cdef A.B *b_ptr = a.createB()
assert b_ptr.square(4) == 16
del b_ptr
class A {
public:
class B {
public:
int square(int x) { return x * x; }
class C {
public:
int cube(int x) { return x * x * x; }
};
};
B* createB() {
return new B();
}
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment