julia> type Person
firstname
lastname
end
julia> fullname(x::Person) = "$(x.firstname) $(x.lastname)"
fullname (generic function with 1 method)
julia> jan=Person("Jan", "Janssen")
Person("Jan","Janssen")
julia> print(fullname(jan))
Janssen Jan
On Saturday, 24 May 2014 19:10:07 UTC+1, Remco wrote:
>
> Hi, I am new to julia and i am not sure how to do this in julia:
>
>
> class Person
> attr_accessor :lastname, :firstname
>
> def fullname
> "#{firstname} #{lastname}"
> end
> end
>
> jan = Person.new
> jan.firstname = "Jan"
> jan.lastname = "Janssen"
>
> puts jan.fullname
>
>
> Regards, Remco
>