Mysterious Warning: no public constructor

Greetings,

I’m wrting my own classes that inherit from TObject, but I don’t understand the source of the following warning. I have searched the forums, searched the manual, and googled. I am in the process of trying to reproducing it with the smallest amount of code possible, but any suggestions for where to look for the source of the warning would be appreciated.

[Given at run time:]

[quote]Warning in TKey::TKey: since TStudy_Data had no public constructor
which can be called without argument, objects of this class
can not be read with the current library. You would need to
add a default constructor before attempting to read it.[/quote]
Whats confusing is that I’m using the default constructor in the context which this appears:

TStudy_Data *study_data = new TStudy_Data(); study_data->Write("test_write",TObject::kOverwrite);
No warnings occur at compile or link time. TStudy_Data inherits publicly from TStudy(pure abstract), which inherits publicly from TObject.

I found this:

[quote]Warning in TBuffer::WriteObjectAny: since Trk::Segment had no public constructor
which can be called without argument, objects of this class
can not be read with the current library. You would need to
add a default constructor before attempting to read it.
Solution
This is a very confusing error message. What it actually means is that there is no dictionary for the concrete implementation of Segment (in this case MuonSegment). The fix was to create the selection.xml etc for MuonSegment, and then to add the dict jobOptions to the top jobOptions. [/quote]
at this atlas wiki: https://twiki.cern.ch/twiki/bin/view/Atlas/TroubleshootingPersistency, but its not really helpful, as that my dictionary for this class seems to be complete, and all my methods are defined, so the vtable should be complete, too. All constructors and methods for this class seem to be working when called in my code, but TKey, TBuffer etc don’t seem to be getting all the information they need.

Thanks,

Homer

The message appears when you read your class. The system cannot create an object
of class TSudy_Data because it cannot find a default public constructor.
Could you send the shortest possible piece of code that we can use to understand your problem?

Rene

Strange.

The abstract parent class TStudy had a purely virtual method

where variable_levels_t is an enumerated data type. I had accidentally declared this in the class header of TStudy_Data as

note that the argument’s const is missing. Changing this and this alone solves the problem.

My instinct is to say that this shouldn’t link, since the child class should have inherited a purely virtual method, but maybe there’s not that big of a difference in the vtable between a const enum and enum if passed by value.

[quote]
My instinct is to say that this shouldn’t link, since the child class should have inherited a purely virtual method, but maybe there’s not that big of a difference in the vtable between a const enum and enum if passed by value.[/quote]

In C++

void fun(int);
void fun(const int);

Are two declarations of the same function.
If you try:

[code]
void fun(int)
{
}

void fun(const int)
{
}

int main(){}[/code]

It will not compile, because you violated one definition rule.

So, if you have in base class

and in derived class

Your derived class in not an abstract class anymore and this function is
final overrider (in wodrs of C++ standard).[/code]

Hi,

this is due to a know limitation in CINT; I’ll make sure that it will be solved when we fix the overload resolution in CINT.

Cheers, Axel.