Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
1c7b7b3d
Commit
1c7b7b3d
authored
Jul 09, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix cpp class example (now that we have function overloading).
parent
d69139fc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
4 deletions
+2
-4
tests/run/cpp_classes.pyx
tests/run/cpp_classes.pyx
+2
-2
tests/run/shapes.h
tests/run/shapes.h
+0
-2
No files found.
tests/run/cpp_classes.pyx
View file @
1c7b7b3d
...
@@ -23,7 +23,7 @@ cdef extern from "shapes.h" namespace shapes:
...
@@ -23,7 +23,7 @@ cdef extern from "shapes.h" namespace shapes:
cdef
cppclass
Square
(
Rectangle
):
cdef
cppclass
Square
(
Rectangle
):
int
side
int
side
# __init__(int) # need function overloading
__init__
(
int
)
int
constructor_count
,
destructor_count
int
constructor_count
,
destructor_count
...
@@ -41,7 +41,7 @@ def test_rect_area(w, h):
...
@@ -41,7 +41,7 @@ def test_rect_area(w, h):
del
rect
del
rect
def
test_square_area
(
w
):
def
test_square_area
(
w
):
cdef
Square
*
sqr
=
new
Square
(
w
,
w
)
cdef
Square
*
sqr
=
new
Square
(
w
)
cdef
Rectangle
*
rect
=
sqr
cdef
Rectangle
*
rect
=
sqr
try
:
try
:
return
rect
.
area
(),
sqr
.
area
()
return
rect
.
area
(),
sqr
.
area
()
...
...
tests/run/shapes.h
View file @
1c7b7b3d
...
@@ -31,8 +31,6 @@ namespace shapes {
...
@@ -31,8 +31,6 @@ namespace shapes {
{
{
public:
public:
Square
(
int
side
)
:
Rectangle
(
side
,
side
)
{
this
->
side
=
side
;
}
Square
(
int
side
)
:
Rectangle
(
side
,
side
)
{
this
->
side
=
side
;
}
/* need until function overloading in Cython */
Square
(
int
side
,
int
ignored
)
:
Rectangle
(
side
,
side
)
{
this
->
side
=
side
;
}
int
side
;
int
side
;
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment