Re: Throwing Errors
"Ruben" <ruben@www2.mrbrklyn.com> wrote in message =
news:pan.2008.09.16.23.44.24.196854@www2.mrbrklyn.com...
On Tue, 16 Sep 2008 12:50:26 -0700, Andrey Tarasevich wrote:
Same thing. The search for the matching handler is not in any way =
tied to
the data structures. It has nothing to do with inheritance or any =
other
relationships, like 'has-a'. As stated above, it is defined by the
run-time sequence of function call contexts.
but if one object is calling anoother object why is it not in the =
stack
An object does not call. An object cannot be called.
main calls a construstor which instantates an object which calls =
another
constructor which instantates another object which causes an error.
The constructor is a function. One function can call another function.
A constructor can call another constructor. In that case the first
constructor can "catch" exceptions "thrown" by the second constructor.
E.g.:
class FirstClass {
AnotherClass AnotherObject;
FirstClass (); // Constructor
};
FirstClass::FirstClass () try
: AnotherObject () // Call construcor of another class
{
} catch (...) {
// Handle exceptions in the construction of AnotherObject.
}
}