# Parametric Type Ctor

**URL:** <https://discourse.julialang.org/t/parametric-type-ctor/10842>\
**Category:** New to Julia\
**Created:** [May 11, 2018, 3:43pm UTC](https://discourse.julialang.org/t/parametric-type-ctor/10842 "2018-05-11T15:43:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![LaurentPlagne](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/laurentplagne/32/10103_2.png) [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Post date:** [May 11, 2018, 3:43pm UTC](https://discourse.julialang.org/t/parametric-type-ctor/10842/1 "2018-05-11T15:43:04Z")

</div>

Hello,  
I want to build a type named TBSCM with tho parameter and I have problem with the constructor…

```julia

struct TBSCM{T,N}
    data::Array{T,2}
    function TBSCM{T,N}(s::Int) where T where N
        new{T,N}(zeros(T,N,s))
    end 
end

s=10^6

a4=TBSCM{4}(s)

```

returns an error like it ignore the Ctor…  
Thank you for your help.

---

<div class="post-metadata">

**Author:** ![tshort](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tshort/32/43_2.png) [@tshort](https://discourse.julialang.org/u/tshort)\
**Post date:** [May 11, 2018, 4:00pm UTC](https://discourse.julialang.org/t/parametric-type-ctor/10842/2 "2018-05-11T16:00:12Z")

</div>

Don’t you need a constructor something like the following to fill in both T and N?

```julia
a4=TBSCM{Float64,4}(s)

```

---

<div class="post-metadata">

**Author:** ![LaurentPlagne](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/laurentplagne/32/10103_2.png) [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Post date:** [May 11, 2018, 4:13pm UTC](https://discourse.julialang.org/t/parametric-type-ctor/10842/3 "2018-05-11T16:13:04Z")

</div>

Oops, thank you very much !

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [May 11, 2018, 5:32pm UTC](https://discourse.julialang.org/t/parametric-type-ctor/10842/4 "2018-05-11T17:32:22Z")

</div>

Semi irrelevant but the constructor would be better off as an outer constructor.

---

<div class="post-metadata">

**Author:** ![LaurentPlagne](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/laurentplagne/32/10103_2.png) [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Post date:** [May 11, 2018, 6:23pm UTC](https://discourse.julialang.org/t/parametric-type-ctor/10842/5 "2018-05-11T18:23:16Z")

</div>

At least not irrelevant for me. I am learning Julia and I have to understand the programming style as well.
