VB中可不可以把函数当做另一个函数的形参来传递
如题,下面我给出一个样本,请各位不吝赐教Private Function n1(ByVal s1 As Double) As Double
Return s1
End Function
Private Function n2(ByVal s2 As Double) As Double
Return s2 * s2
End Function
Private Function n3(ByVal s2 As Double) As Double
Return s2 * s2 * s2
End Function
rivate Function GetMK(ByVal a As Double, ByVal b As Double, ByVal k As Integer) As Double
Dim x As Double, y As Double, h As Double
Dim n As Long, j As Long
x = 0 : y = 0 : h = 0
n = 1 : j = 0
For j = 0 To k Step 1
n = n * 2
Next
h = (b - a) / n
x = a + h / 2
For j = 0 To n Step 1
y = y + n1(x)//这里的函数不是特定,可以通过GetMK(........)里的参数,这里的参数可不可以是上面的函数,如果可以请帮我改进一下程序,谢谢各位啦
x = x + h
Next
Return (h * y)
End Function
在上述的红色字体是函数,
怎样用统一的函数来实现积分目的,