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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
1ca9c605
Commit
1ca9c605
authored
Jul 07, 2009
by
Danilo Freitas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test files for cpp classes.
parent
35c00698
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
0 deletions
+64
-0
tests/run/cpp_classes.pyx
tests/run/cpp_classes.pyx
+18
-0
tests/run/shapes.cpp
tests/run/shapes.cpp
+15
-0
tests/run/shapes.h
tests/run/shapes.h
+31
-0
No files found.
tests/run/cpp_classes.pyx
0 → 100644
View file @
1ca9c605
cdef
extern
from
"shapes.h"
namespace
shapes
:
cdef
cppclass
Shape
:
area
()
cdef
cppclass
Rectangle
(
Shape
):
int
width
int
height
__init__
(
int
,
int
)
cdef
cppclass
Square
(
Shape
):
int
side
__init__
(
int
)
cdef
Rectangle
*
rect
=
new
Rectangle
(
10
,
20
)
cdef
Square
*
sqr
=
new
Square
(
15
)
del
rect
,
sqr
tests/run/shapes.cpp
0 → 100644
View file @
1ca9c605
#include "shapes.h"
using
namespace
shapes
;
Rectangle
::
Rectangle
(
int
width
,
int
height
)
{
this
->
width
=
width
;
this
->
height
=
height
;
}
Square
::
Square
(
int
side
)
{
this
->
side
=
side
;
}
tests/run/shapes.h
0 → 100644
View file @
1ca9c605
#ifndef SHAPES_H
#define SHAPES_H
namespace
shapes
{
class
Shape
{
public:
virtual
float
area
()
=
0
;
virtual
~
Shape
()
{
}
};
class
Rectangle
:
public
Shape
{
public:
Rectangle
(
int
width
,
int
height
);
float
area
()
{
return
width
*
height
;
}
int
width
;
int
height
;
};
class
Square
:
public
Shape
{
public:
Square
(
int
side
);
float
area
()
{
return
side
*
side
;
}
int
side
;
};
}
#endif
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