萌新求问一个简单的代码问题.
abstract type AbstractArray1{T1,T2,T3,T4} end
struct grid{T1,T2,T3,T4} <: AbstractArray1{T1,T2,T3,T4}
A::T1
B::T2
C::T3
D::T4
function grid{T1,T2,T3,T4}(t1,t2,t3,t4) where {T1<:Int64, T2<:Float64 , T3<:String , T4<:String}
A = t1
B = t2
C = t3
D = t4
return new(A,B,C,D)
end
end
u1 = grid(1,2.0,"hello","where")
执行后总是报错:
ERROR: LoadError: MethodError: no method matching grid(::Int64, ::Float64, ::String, ::String)
Stacktrace:
另,怎么写一个带多参数类型的外部构造函数?我不知道怎么在外部构造函数中返回对象.
文档给的资料似乎只能在终端中执行