Advertisement
Guest User

Untitled

a guest
Dec 8th, 2015
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Eiffel 0.80 KB | None | 0 0
  1. note
  2.     description: "Summary description for {PERSON}."
  3.     author: ""
  4.     date: "$Date$"
  5.     revision: "$Revision$"
  6.  
  7. class
  8.     PERSON
  9.  
  10. create
  11.     set_name
  12.  
  13. feature
  14.     name: STRING
  15.  
  16. feature
  17.     set_name(a_name: STRING)
  18.         require
  19.           no_void_and_name:
  20.             a_name /= Void and then not a_name.is_empty
  21.         do
  22.             name := a_name
  23.         end
  24.  
  25. invariant
  26.     person_has_a_name: name /= Void implies not name.is_empty
  27. end
  28.  
  29.  
  30. note
  31.     description : "new application root class"
  32.     date        : "$Date$"
  33.     revision    : "$Revision$"
  34.  
  35. class
  36.     APPLICATION
  37.  
  38. inherit
  39.     ARGUMENTS
  40.  
  41. create
  42.     make
  43.  
  44. feature {NONE} -- Initialization
  45.  
  46.     make
  47.             -- Run application.
  48.     local
  49.         p1, p2: PERSON
  50.         do
  51.             create p1.set_name ("person 1")
  52.             create p2.set_name (p1.name)
  53.             p1.set_name ("Another name")
  54.             print(p2.name)
  55.         end
  56.  
  57. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement