Class Con_Math Public A Public B Private intC Public Function Sum() intC = cint(A) + cint(B) Sum = intC End Function End Class set math = new Con_Math math.A = 19 math.B = 80 Response.write math.Sum set math = nothing
16 男同志在家吃完飯,是要洗碗洗鍋的吧. set ** = nothing 也是同樣的道理.這個和創(chuàng)建Recordset之后要清掉也是一樣的用法. set nothing以后,就表示它從內(nèi)存里面丟棄了,這個萬能包裝箱所占的位置就空出來了,你的網(wǎng)站性能當然會提高,還猶豫什么? 用完了趕緊set nothing. 我知道大家都不會這么玩Function的,至少是Sum(19,80)才更方便使用,好,我們在包裝箱上再打一個洞出來:
復制代碼 代碼如下:
Class Con_Math Public A Public B Private intC Public Function Sum() intC = cint(A) + cint(B) Sum = intC End Function Public Function Sum2(ByVal vA,ByVal vB) Sum2 = cint(vA) + cint(vB) End Function End Class set math = new Con_Math Response.write math.Sum2(19,80) set math = nothing