public
Last active

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
$ erlc nick.erl && erlc vanessa.erl
 
1> Me = nick:new("Mountain View", "CA").
{nick,"Mountain View","CA"}
2> Me:city().
nick:city/0 -> "Mountain View"
ok
3> Me:state().
nick:state/0 -> "CA"
ok
4> Vanessa = vanessa:new("Mountain View", "CA").
{vanessa,{nick,"Mountain View","CA"},"Mountain View","CA"}
5> Vanessa:city().
child:city/0 -> "Mountain View"
ok
6> Vanessa:state().
nick:state/0 -> "CA"
ok
7>
nick.erl
Erlang
1 2 3 4 5 6 7 8 9
-module(nick, [City, State]).
 
-export([city/0, state/0]).
 
state() ->
io:format("nick:state/0 -> ~p~n", [State]).
 
city() ->
io:format("nick:city/0 -> ~p ~n", [City]).
vanessa.erl
Erlang
1 2 3 4 5 6
-module(vanessa, [City, State]).
-extends(nick).
-export([city/0]).
 
city() ->
io:format("child:city/0 -> ~p ~n", [City]).

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.