Saturday 16 April 2016

Julia: Singleton types


A composite type with no fields is called as singleton type. A single ton type has only one instance, throughout the application life time.

julia> type DBConn
       end

julia> obj1=DBConn()
DBConn()

julia> obj2=DBConn()
DBConn()

julia> obj3=DBConn()
DBConn()

julia> is(obj1, obj2)
true

julia> is(obj1, obj3)
true



Previous                                                 Next                                                 Home

No comments:

Post a Comment