I want to know why I have to pass dataManager(inst...
# android
k
I want to know why I have to pass dataManager(instance of DataManager), I only want that when I call getData() ,then at call time I have to pass function of DataManager that takes only parameter WebDataListener<T>
e
Because the type of
func
is
DataManager.(Listener) -> Unit
, you have to specify which
DataManager
is used to receive the
.(Listener) -> Unit
function call
k
ok I got it
but one last thing I want to know is that,i only want to perform function call of func() in getData() but I also have to specify it parameters when I am calling getData()
e
I don't quite get what you mean, could you explain a bit?
getData(listener) {}
is what you need to call
getData()
, you don't have to pass a
DataManager
into the lambda
k
i only want to call HighOreder (func) inside getData() function, but when i calling getData() then i am asked to call func like getData(otherParams){ BaseDataDelegation(this,listener)// i don't want to call it here}
e
The point of higher order function is that the caller don't need to know the function impl, the impl is provided by the caller
k
but can i use method refrence here like DataManger::functionName , actully i have used this and its working , i want your advice
e
That's the correct way I think
k
yea its working correctly but i don't have any Refrence of it so therefore i'm doubting this and not sure about it