java: 先执行父类的构造函数,然后是引用对象的构造函数(必须有new声明实际类型),然后是自己的构造函数.
{ 【程序编程相关:采用SimpleValue 解决TOP编】public class test 【推荐阅读:java设计模式之创建模式--singl】 { 【扩展信息:使用Appfuse的核心与关键】 public static void main(string[] args) child child = new child(); }}class parent
{ parent() { system.out.println("to construct parent."); } }class child extends parent
{ child() { system.out.println("to construct child."); } delegatee delegatee = new delegatee(); } class delegatee { delegatee() { system.out.println("to construct delegatee."); }}结果是而c#的构造函数执行顺序是:先引用对象,在父类,再子类.to construct parent.to construct delegatee.to construct child.using system;... 下一页