[C++-sig] How to add new constructor in a class

Matthew Scouten (TT) Matthew.Scouten at tradingtechnologies.com
Mon Jun 21 17:02:23 CEST 2010


Why not just subclass A as A_wrapper, add the necessary ctor to
A_wrapper and expose that instead? 

-----Original Message-----
From:
cplusplus-sig-bounces+matthew.scouten=tradingtechnologies.com at python.org
[mailto:cplusplus-sig-bounces+matthew.scouten=tradingtechnologies.com at py
thon.org] On Behalf Of vishal bayskar
Sent: Friday, June 18, 2010 5:59 AM
To: cplusplus-sig at python.org
Subject: [C++-sig] How to add new constructor in a class


In the below example I need to add a constructor A(). How to do that?

class A{
public:
        A(int);
        int getA();
private:
        int a;
};


I have tried add_declaration_code and add_registration_code but it seems
that these will not work for 
the case of contructor.

Does these work and I am doing somthing wrong?


I also tried to create constructor using
decl_factory_t.create_constructor()
but I am not able to add the constructor in the wrapper code

Please let me know the possible solution

One more query Can I overwrite some constructor 
If suppose a constructor is declared as private can I change it's access
as
a public (or can I overwrite it somehow)?





-- 
View this message in context:
http://old.nabble.com/How-to-add-new-constructor-in-a-class-tp28924798p2
8924798.html
Sent from the Python - c++-sig mailing list archive at Nabble.com.

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig at python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig


More information about the Cplusplus-sig mailing list