Commit 6514ac89 authored by Julien Jerphanion's avatar Julien Jerphanion

Add snippet for allocation and initialisation behaviour

parent 872a69a5
cdef cypclass Base:
double value
__init__(self, int a):
self.value = (<double> a ) * 1.2
__init__(self, double b):
self.value = b
Base __new__(alloc, int a):
obj = alloc()
return obj
cdef cypclass Derived(Base):
Derived __new__(alloc, double b):
obj = alloc()
return obj
cpdef void test():
base = Base(5)
derived = Derived(5)
print(base.value, derived.value)
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