Updated "filter" example
Signed-off-by: Olivier Ligot <oligot@gmail.com>
This commit is contained in:
@@ -18,6 +18,8 @@ feature -- Initialization
|
||||
create users.make (10)
|
||||
create l_user.make (1, "foo", "bar")
|
||||
users.put (l_user, l_user.id)
|
||||
create l_user.make (2, "demo", "demo")
|
||||
users.put (l_user, l_user.id)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
@@ -7,6 +7,12 @@
|
||||
class
|
||||
USER
|
||||
|
||||
inherit
|
||||
ANY
|
||||
redefine
|
||||
is_equal
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
@@ -34,6 +40,25 @@ feature -- Access
|
||||
password: STRING
|
||||
-- Password
|
||||
|
||||
foo_: STRING
|
||||
do
|
||||
ensure
|
||||
anchor: False
|
||||
end
|
||||
|
||||
feature -- Comparison
|
||||
|
||||
is_equal (other: like Current): BOOLEAN
|
||||
-- Is `other' attached to an object considered
|
||||
-- equal to current object?
|
||||
do
|
||||
if Current = other then
|
||||
Result := True
|
||||
else
|
||||
Result := (id = other.id) and (name = other.name) and (password = other.password)
|
||||
end
|
||||
end
|
||||
|
||||
;note
|
||||
copyright: "2011-2012, Olivier Ligot, Jocelyn Fiat and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
|
||||
Reference in New Issue
Block a user