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
Kirill Smelkov
cython
Commits
c62cd655
Commit
c62cd655
authored
Oct 29, 2014
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test for non-default constructor in bases.
parent
e22c29ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
tests/run/cpp_classes.pyx
tests/run/cpp_classes.pyx
+4
-1
tests/run/shapes.h
tests/run/shapes.h
+10
-4
No files found.
tests/run/cpp_classes.pyx
View file @
c62cd655
...
...
@@ -7,7 +7,10 @@ cdef extern from "shapes.h" namespace "shapes":
cdef
cppclass
Shape
:
float
area
()
cdef
cppclass
Circle
(
Shape
):
cdef
cppclass
Ellipse
(
Shape
):
Ellipse
(
int
a
,
int
b
)
except
+
cdef
cppclass
Circle
(
Ellipse
):
int
radius
Circle
(
int
r
)
except
+
...
...
tests/run/shapes.h
View file @
c62cd655
...
...
@@ -40,11 +40,17 @@ namespace shapes {
Square
(
int
side
)
:
Rectangle
(
side
,
side
)
{
this
->
side
=
side
;
}
int
side
;
};
class
Circle
:
public
Shape
{
class
Ellipse
:
public
Shape
{
public:
Ellipse
(
int
a
,
int
b
)
{
this
->
a
=
a
;
this
->
b
=
b
;
}
float
area
()
const
{
return
3.1415926535897931
f
*
a
*
b
;
}
int
a
,
b
;
};
class
Circle
:
public
Ellipse
{
public:
Circle
(
int
radius
)
{
this
->
radius
=
radius
;
}
float
area
()
const
{
return
3.1415926535897931
f
*
radius
;
}
Circle
(
int
radius
)
:
Ellipse
(
radius
,
radius
)
{
this
->
radius
=
radius
;
}
int
radius
;
};
...
...
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