mirror of
https://github.com/kennethreitz/python-guide.git
synced 2026-06-05 14:50:19 +00:00
This is not a highlightable cpp code block
This commit is contained in:
@@ -96,26 +96,27 @@ Example: Overloading __repr__
|
||||
std::string getName();
|
||||
};
|
||||
|
||||
|
||||
:file:`myclass.i`
|
||||
|
||||
.. code-block:: c++
|
||||
.. code-block::
|
||||
:linenos:
|
||||
|
||||
%include "string.i"
|
||||
|
||||
|
||||
%module myclass
|
||||
%{
|
||||
#include <string>
|
||||
#include "MyClass.h"
|
||||
%}
|
||||
|
||||
|
||||
%extend MyClass {
|
||||
std::string __repr__()
|
||||
{
|
||||
return $self->getName();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
%include "MyClass.h"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user