# Creating a simple convert method?

**URL:** <https://discourse.julialang.org/t/creating-a-simple-convert-method/3260>\
**Category:** New to Julia\
**Created:** [April 18, 2017, 5:16am UTC](https://discourse.julialang.org/t/creating-a-simple-convert-method/3260 "2017-04-18T05:16:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![purplishrock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/purplishrock/32/13451_2.png) [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Post date:** [April 18, 2017, 5:16am UTC](https://discourse.julialang.org/t/creating-a-simple-convert-method/3260/1 "2017-04-18T05:16:56Z")

</div>

I’ve been going through the example for writing a convert method and i just can’t get it to work in what should be this very simple case.

Thanks

import Base: -, +, convert

export Point, convert

type Point{T\<:Number}  
x :: T  
y :: T  
z :: T  
end

function convert{T\<:Float64}(::Type{T}, xyz::Tuple{Float64,Float64,Float64})  
Point(xyz[1], xyz[2], xyz[3])  
end  
edit:  
ERROR: MethodError: Cannot `convert` an object of type Tuple{Float64,Float64,Float64} …

---

<div class="post-metadata">

**Author:** ![greg\_plowman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/greg_plowman/32/8100_2.png) [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)\
**Post date:** [April 18, 2017, 5:32am UTC](https://discourse.julialang.org/t/creating-a-simple-convert-method/3260/2 "2017-04-18T05:32:33Z")

</div>

I think you want `::Type{Point{T}}`

---

<div class="post-metadata">

**Author:** ![purplishrock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/purplishrock/32/13451_2.png) [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Post date:** [April 18, 2017, 5:54am UTC](https://discourse.julialang.org/t/creating-a-simple-convert-method/3260/3 "2017-04-18T05:54:26Z")

</div>

yes- that was the problem.

naturally, i caught that mistake right after i posted (why, why does that always happen ?)

Thanks.
