在 Definition.jl
中定义了点的坐标
module Definition
export Point
mutable struct Point
x
y
end
Point()=Point(0.0,0.0)
end # module Definition
在 Distance.jl
中定义了距离运算
module Distance
include("Definition.jl")
using .Definition
export distance
function distance(p1::Point, p2::Point)
dist = hypot(p1.x - p2.x, p1.y - p2.y)
return dist
end
end # module Distance
在 main.jl
中调用出错
include("Definition.jl")
include("Distance.jl")
using .Definition
using .Distance
p1 = Point(2, 3)
p2 = Point(4, 5)
distance(p1, p2)#MethodError: no method matching distance(::Point, ::Point)
请问是哪里出了问题