default-arguments

    14熱度

    5回答

    在PHP中,您可以調用函數。通過不使用這些語句調用所有參數。 function test($t1 ='test1',$t2 ='test2',$t3 ='test3') { echo "$t1, $t2, $t3"; } ,你可以直接使用該函數是這樣 test(); 所以讓我們只說我想最後一個是不同的,但沒有其他人。我可以的事情,唯一的方法是沒有成功這樣做: test('test1'

    60熱度

    1回答

    我收到此錯誤信息與下面的代碼中給出默認參數: class Money { public: Money(float amount, int moneyType); string asString(bool shortVersion=true); private: float amount; int moneyType; }; 首先,我認爲默認參數不允