# Getproperty, decorations, inheritance in 0.7

**URL:** https://discourse.julialang.org/t/getproperty-decorations-inheritance-in-0-7/11237
**Category:** General Usage
**Created:** [May 29, 2018, 2:48pm UTC](https://discourse.julialang.org/t/getproperty-decorations-inheritance-in-0-7/11237 "2018-05-29T14:48:27Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)
#### Post date: [May 29, 2018, 2:55pm UTC](https://discourse.julialang.org/t/getproperty-decorations-inheritance-in-0-7/11237/3 "2018-05-29T14:55:53Z")

</div>

You can lift the argument to type domain, for example:

```julia
struct Foo
    x::Int
end
Base.getproperty(foo::Foo, s::Symbol) = bar(foo, Val(s))
bar(foo::Foo, ::Val{T}) where {T} = getfield(foo, T) # fall back to getfield
bar(foo::Foo, ::Val{:y}) = println("Hello, world!")

```

```julia
julia> foo = Foo(4)
Foo(4)

julia> foo.x
4

julia> foo.y
Hello, world!

```

Edit: Which is what Mauro linked to.

---

_[View the full topic](https://discourse.julialang.org/t/getproperty-decorations-inheritance-in-0-7/11237)._
