instance-variables

    0熱度

    4回答

    我可以使用Java初始化實例變量,當我聲明它時初始化該實例變量,並使用稍後在類中定義的方法的返回值對其進行初始化。 事情是這樣的: public class MyClass { integers[] myArray = new integers[length()]; int length() { .... } } length()給了我一些數字,

    10熱度

    1回答

    我在獲取單例模式在smalltalk中初始化一個實例變量時遇到了麻煩。 (這裏是澄清link to another implementation) 這是我有: new ^UniqueInstance ifNil: [UniqueInstance := self basicNew. UniqueInstance: instanceVar := Object new. ].