|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
public default constructorHi,
In makecint.txt it is stated that a public default constructor is required in order to be able to access the class from the interpreter. Unfortunately, we usually declare the default constructor private or protected and instantiate objects via static "New(...)" member methods. For testing purposes, I modified the header to look like #ifdef G__DICTIONARY public: #else protected: #endif Is there a better way, optimally not enabling access to the default constructor within the interpreter? Thanks, Sascha |
|
|
Re: public default constructorHi Sascha,
> In makecint.txt it is stated that a public default constructor is > required in order to be able to access the class from the interpreter. This sounds like an over statement :) You should be able to use your code as-is (and of course you will only be able to create your objects via the New(...) member methods :)). Cheers, Philippe. Zelzer Sascha wrote: > Hi, > > In makecint.txt it is stated that a public default constructor is > required in order to be able to access the class from the interpreter. > Unfortunately, we usually declare the default constructor private or > protected and instantiate objects via static "New(...)" member methods. > > For testing purposes, I modified the header to look like > > #ifdef G__DICTIONARY > public: > #else > protected: > #endif > > > Is there a better way, optimally not enabling access to the default > constructor within the interpreter? > > Thanks, > > Sascha > > |
|
|
Re: public default constructorHi,
in the reflex context I decided to migrate to a helper class at some point which does the news and deletes, and which you could specialize for your classes, and which you could declare as friend. Alas I haven't gotten around actually implementing it for Reflex, let alone for CINT. So for now your approach is the only valid one. [There is also a "#define private public" in the dictionaries, but that doesn't work well with all compilers and does not really qualify as a solution either :-)] But of course you are very welcome to submit a patch for the dictionary utility class! Cheers, Axel. On 2009-01-20 16:15, Zelzer Sascha wrote: > Hi, > > In makecint.txt it is stated that a public default constructor is > required in order to be able to access the class from the interpreter. > Unfortunately, we usually declare the default constructor private or > protected and instantiate objects via static "New(...)" member methods. > > For testing purposes, I modified the header to look like > > #ifdef G__DICTIONARY > public: > #else > protected: > #endif > > > Is there a better way, optimally not enabling access to the default > constructor within the interpreter? > > Thanks, > > Sascha > > |
|
|
Re: public default constructorHi,
well, and anything requiring temporaries won't work... Cheers, Axel. On 2009-01-20 16:27, Philippe Canal wrote: > Hi Sascha, > >> In makecint.txt it is stated that a public default constructor is >> required in order to be able to access the class from the interpreter. > > This sounds like an over statement :) > > You should be able to use your code as-is (and of course you will only > be able to create > your objects via the New(...) member methods :)). > > Cheers, > Philippe. > > > Zelzer Sascha wrote: >> Hi, >> >> In makecint.txt it is stated that a public default constructor is >> required in order to be able to access the class from the interpreter. >> Unfortunately, we usually declare the default constructor private or >> protected and instantiate objects via static "New(...)" member methods. >> >> For testing purposes, I modified the header to look like >> >> #ifdef G__DICTIONARY >> public: >> #else >> protected: >> #endif >> >> >> Is there a better way, optimally not enabling access to the default >> constructor within the interpreter? >> >> Thanks, >> >> Sascha >> >> > > |
|
|
AW: public default constructorHi Philippe and Axel,
thanks for your suggestions! Philippe is right that I don't need a public default constructor. The problem was that I wrote a separate header file containing a subset of the public method declarations of some class. The original header file declared the default constructor protected but the header file for cint didn't, so the generated code (the G__cpp_ file) had a reference to a default constructor and when gcc compiled the G__cpp_ file (which included the original header file), it complained about the default constructor being not accessible. Thanks again, Sascha > -----Ursprüngliche Nachricht----- > Von: owner-cint@... [mailto:owner- > cint@...] Im Auftrag von Philippe Canal > Gesendet: Dienstag, 20. Januar 2009 16:27 > An: Zelzer Sascha > Cc: cint@... > Betreff: Re: [CINT] public default constructor > > Hi Sascha, > > > In makecint.txt it is stated that a public default constructor is > > required in order to be able to access the class from the > interpreter. > > This sounds like an over statement :) > > You should be able to use your code as-is (and of course you will only > be able to create > your objects via the New(...) member methods :)). > > Cheers, > Philippe. > > > Zelzer Sascha wrote: > > Hi, > > > > In makecint.txt it is stated that a public default constructor is > > required in order to be able to access the class from the > interpreter. > > Unfortunately, we usually declare the default constructor private or > > protected and instantiate objects via static "New(...)" member > methods. > > > > For testing purposes, I modified the header to look like > > > > #ifdef G__DICTIONARY > > public: > > #else > > protected: > > #endif > > > > > > Is there a better way, optimally not enabling access to the default > > constructor within the interpreter? > > > > Thanks, > > > > Sascha > > > > |
| Free embeddable forum powered by Nabble | Forum Help |