home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / program / language / grs / g / Book2 < prev    next >
Encoding:
Text File  |  1991-04-14  |  2.2 KB  |  65 lines

  1. instanceof class book1;
  2.  
  3. book1 := class.new(
  4.             "book1",
  5.             [
  6.                {
  7.                   null function set( string s; integer i;
  8.                                      listof integer l; instanceof person p )
  9.                   {
  10.                      assume string title;
  11.                             listof integer publication_dates;
  12.                             integer number_of_pages;
  13.                             instanceof person author in
  14.                      {
  15.                         title := s;
  16.                         publication_dates := l;
  17.                         number_of_pages := i;
  18.                         author := p;
  19.                      };
  20.                   };
  21.                },
  22.                {
  23.                   null function show()
  24.                   {
  25.                      assume string title;
  26.                             listof integer publication_dates;
  27.                             integer number_of_pages;
  28.                             instanceof person author in
  29.                      {
  30.                         write("\nBook : ",title,"\n");
  31.                         write("published in : ");
  32.                         foreach i in publication_dates do
  33.                            write(i," ");
  34.                         write("\nno of pages : ",number_of_pages,"\n\n");
  35.                         write("Author :\n");
  36.                         author.show();
  37.                      };
  38.                   };
  39.                },
  40.                {
  41.                   instanceof person function get_author()
  42.                   {
  43.                      assume instanceof person author in
  44.                         return author;
  45.                   };
  46.                },
  47.                {
  48.                   null function republished( integer date )
  49.                   {
  50.                      assume listof integer publication_dates in
  51.                         publication_dates := publication_dates + [date];
  52.                   };
  53.                }
  54.             ],
  55.             [
  56.                {
  57.                   string title;
  58.                   listof integer publication_dates;
  59.                   integer number_of_pages;
  60.                   instanceof person author;
  61.                }
  62.             ]
  63.             );
  64.  
  65.