Behaviour During Construction and Destruction
Languages differ in their behaviour while the constructor or destructor of an object is running. For some languages, notably C++, the virtual dispatching mechanism has different semantics during construction and destruction of an object. While it is recommended that virtual function calls in constructors should be avoided for C++, in some other languages, for example C# and Java, the derived implementation can be called during construction and design patterns such as the Abstract Factory Pattern actively promote this usage in languages supporting the ability.
Read more about this topic: Virtual Function
Famous quotes containing the words behaviour, construction and/or destruction:
“I cannot be much pleased without an appearance of truth; at least of possibilityI wish the history to be natural though the sentiments are refined; and the characters to be probable, though their behaviour is excelling.”
—Frances Burney (17521840)
“No real vital character in fiction is altogether a conscious construction of the author. On the contrary, it may be a sort of parasitic growth upon the authors personality, developing by internal necessity as much as by external addition.”
—T.S. (Thomas Stearns)
“I ... must continue to strive for more knowledge and more power, though the new knowledge always contradicts the old and the new power is the destruction of the fools who misuse it.”
—George Bernard Shaw (18561950)