Hello NG,
knowing that I am not so good in C++ programming, could anyone please
explain me how can I convert this simple C++ lines in a Python class declaration
+ __init__ function?
Suppose that wxFoldPanelItem is a class I already have written.
class wxFoldPanel
{
private:
wxFoldPanelItem *_item;
public:
/** Constructor, usually not directly used by the developer. */
wxFoldPanel(wxFoldPanelItem *item)
: _item(item)
{
}
And, if you can, what does it mean this:
/** Copy operator to assign one instance to the other, this is needed because
these classes are passed as instance not by reference. */
virtual void operator=(const wxFoldPanel &item) {
_item = item._item;
I suppose there is a smarter way to do it in Python...
Thanks to you all.
Andrea.
andrea_gavana@tin.it writes:
> Hello NG,
>
> knowing that I am not so good in C++ programming, could anyone please
> explain me how can I convert this simple C++ lines in a Python class declaration
> + __init__ function?
>
> Suppose that wxFoldPanelItem is a class I already have written.
>
> class wxFoldPanel
> {
> private:
> wxFoldPanelItem *_item;
>
> public:
> /** Constructor, usually not directly used by the developer. */
> wxFoldPanel(wxFoldPanelItem *item)
> : _item(item)
> {
> }
>
class wxFoldPanel:
def __init__(self, item):
self._item = item
>
> And, if you can, what does it mean this:
>
> /** Copy operator to assign one instance to the other, this is needed because
> these classes are passed as instance not by reference. */
> virtual void operator=(const wxFoldPanel &item) {
> _item = item._item;
>
> I suppose there is a smarter way to do it in Python...
>
> Thanks to you all.
>
You usually don't have to (or want to) do this in python. I dropped all such
things when I converted OGL. Python only has references, so trying to "undo"
the reference handling would just be confusing.
···
--
Pierre Hjälm
Hello Pierre,
class wxFoldPanel:
def __init__(self, item):
self._item = item
OK, so I have done it correctly. I just needed a confirmation from someone
that knows better than me C++
Thank you a lot.
Andrea.