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:
“The methodological advice to interpret in a way that optimizes agreement should not be conceived as resting on a charitable assumption about human intelligence that might turn out to be false. If we cannot find a way to interpret the utterances and other behaviour of a creature as revealing a set of beliefs largely consistent and true by our standards, we have no reason to count that creature as rational, as having beliefs, or as saying anything.”
—Donald Davidson (b. 1917)
“When the leaders choose to make themselves bidders at an auction of popularity, their talents, in the construction of the state, will be of no service. They will become flatterers instead of legislators; the instruments, not the guides, of the people.”
—Edmund Burke (17291797)
“Though castles topple on their warders heads,
Though palaces and pyramids do slope
Their heads to their foundations; though the treasure
Of natures germens tumble all together,
Even till destruction sickenanswer me
To what I ask you.”
—William Shakespeare (15641616)