can i overload `Double::div`? i'd like for it to r...
# announcements
h
can i overload
Double::div
? i'd like for it to return
0.0
when dividing by
0.0
in this scope
n
you could create a
safeDiv
method without the benefit of an operator
h
yeah, i can, but it's a shame i can't just overload it
n
overloading means subclassing
h
what's the term for overriding a function in a scope, then?
just overriding?
n
sorry, i meant overriding the first time overriding means a parent-child relationship and the child overrides the behavior of the parent that’s what you want: you have a class
Double
a function
div()
and you want to change its behavior this is not possible... unless you create your own subclass of
Double
and it’s final
k
👍 1