[C++-sig] Constructors (and destrucrtors) wrappers
Eric Jardim
ericjardim at gmail.com
Mon Mar 28 17:04:28 CEST 2005
Hi, again...
There is a case where I have an object constructor that recieves the
(int argc, char** argv) parameter from the main function:
class QApplication {
public:
QApplication(int argc, char** argv) {...}
...
};
int
main(int argc, char** argv)
{
obj = new QApplication(argc, argv);
...
}
Is it possible to change the way it is constructed, just passing a
list of args (the way of python does)
>>> import sys
>>> import Qt
>>> app = Qt.QApplication(sys.argv)
>>> ...
I thinked some possibilities:
* Creating a free function (or static method) with a factory role.
But it could confuse the API...
* Extending the class and reimplementing the constructor. I am
afraid of this, because I do not know how extended objects will behave
in python. Especially if some of them are constructed internally (in
c++).
The same question is applied to destructors.
Any help and insights are welcome :)
thanks,
[Eric Jardim]
More information about the Cplusplus-sig
mailing list