"Dario" <da***@despammed.com> wrote in message news:bk**********@grillo.cs.interbusiness.it...
No-one is able to give me an help ?
I thought I did. Maybe we misunderstood your question.
The program behaves as expected. When you convert a derived class (LogicError)
a base class (exception), the object you create is the base class (exception). It's
not polymorphic, it is the base class initialzed with pieces of your derived class.
The reason it behaves differently between Linux an WIndows, is that exception::what()
returns diferent things on those machines. If you wrote:
int main() {
exception e;
cout << e.what() << endl;
}
and ran it on both machiens, you'd get the same thing you see for your first print in your
program. The standard just says the string is "implementation defined." In the case of
VC++ 6.0 it appears to just be an empty string. In VC++ 7 it is "unkonwn exception".
On Linux, it's "exception." All of these are technically correct.
When you use a reference to the base class instead, you have a polymorphic reference
to the derived object with the static type of the base class. In this case, the virtual function
what() returns your "child description."
Does this help? If not, you'll have to ask a more detailed question and we'll be glad to
explain further.
-Ron