# Composite types and their subtypes

**URL:** https://discourse.julialang.org/t/composite-types-and-their-subtypes/38371
**Category:** New to Julia
**Tags:** question
**Created:** [April 28, 2020, 1:25pm UTC](https://discourse.julialang.org/t/composite-types-and-their-subtypes/38371 "2020-04-28T13:25:33Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![markmbaum](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/markmbaum/32/32745_2.png) [@markmbaum](https://discourse.julialang.org/u/markmbaum)
#### Post date: [April 28, 2020, 1:25pm UTC](https://discourse.julialang.org/t/composite-types-and-their-subtypes/38371/1 "2020-04-28T13:25:33Z")

</div>

I’m still getting used to the type system in Julia. Is the following composite type,

```julia
mutable struct Point{Float64}
    x
    y
end

```

equivalent to

```julia
mutable struct Point
    x::Float64
    y::Float64
end

```

It seems like the answer is no?

---

<div class="post-metadata">

### Author: ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)
#### Post date: [April 28, 2020, 1:46pm UTC](https://discourse.julialang.org/t/composite-types-and-their-subtypes/38371/2 "2020-04-28T13:46:32Z")

</div>

You’re correct that the answer is no. See: [Types · The Julia Language](https://docs.julialang.org/en/v1/manual/types/#Parametric-Types-1)

Your first type has a type parameter with the name `Float64` which does absolutely nothing. The fields `x` and `y` can still be of any type. Moreover, the fact that the type parameter has a name which is the same as an existing type (`Float64`) is totally irrelevant.

Your second type, on the other hand, actually restricts the `x` and `y` fields to be of type `Float64`.

To implement a parametric `Point` type, you want something like this:

```julia
mutable struct Point{T}
  x::T 
  y::T 
end

```

which creates a struct with a parameter named `T` and two fields which must both be of that same type `T`.
