{"id":103,"date":"2012-04-22T15:36:54","date_gmt":"2012-04-22T13:36:54","guid":{"rendered":"https:\/\/herr-rau.de\/blogs\/inform\/?page_id=103"},"modified":"2012-04-29T09:00:55","modified_gmt":"2012-04-29T07:00:55","slug":"vererbung","status":"publish","type":"page","link":"https:\/\/herr-rau.de\/blogs\/inform\/?page_id=103","title":{"rendered":"Vererbung"},"content":{"rendered":"<p>In Inform 7 gibt es keine Mehrfachvererbung, anders als in der zugrunde liegenden Sprache Inform 6. Vererbung geschieht mit dem Schl\u00fcsselwort &#8220;is a kind of&#8221;.<\/p>\n<p>Vielleicht soll es in einem Spiel viele B\u00fccher geben, so dass es sich lohnt, eine Klasse daf\u00fcr einzuf\u00fchren. Hier die Klasse Buch und ein Beispielobjekt dazu:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">A book is a kind of thing. It has a text called title. It has a number called page number. It has a text called subject.\r\n\r\nThe diary is a book in the House. The description is &quot;A small, black book with hand-written entries.&quot; The title is &quot;Red's Secret Diary&quot;. The page number is 80. The subject is &quot;Little Red Riding Hood and her adventures.&quot;\r\n<\/pre>\n<p>Die Buchklasse erbt von der Ding-Klasse alle deren Attribute (darunter Essbarkeit, Tragbarkeit, Beleuchtungszustand) sowie die Attribute von deren Oberklasse. Alle Regeln, die f\u00fcr ein <code>thing<\/code> gelten, treffen auch auf <code>books<\/code> zu.<\/p>\n<p>Hier die Klasse Spiel und ein Beispielobjekt dazu:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">A game is a kind of thing. It has a text called title. It has a number called player number.\r\n\r\nMonopoly is a game in the House. The description is &quot;A box with a cardboard game board and lots of little green and red houses. And money, too.&quot; The player number is 6. The title is &quot;Monopoly. An exciting game for all the family.&quot;\r\n<\/pre>\n<p>Eine Klasse f\u00fcr Waffen und ein Beispiel:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">A weapon is a kind of thing. It has a number called level. The level usually is 1. \r\n\r\nThe rusty sword is a weapon in the House. The description is &quot;A rusty old sword, but still sharp.&quot; \r\n<\/pre>\n<p>Hier eine spezielle Art von Waffe, n\u00e4mlich eine Schusswaffe, und ein Beispiel:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">A gun is a kind of weapon. The level is usually 2. It has number called range. The range is usually 10.  It has a number called ammunition. The ammunition is usually 6.\r\n\r\nThe Smith &amp; Wesson is a gun in the House. Understand &quot;gun&quot; and &quot;handgun&quot; as the Smith &amp; Wesson. The range is 8.\r\n<\/pre>\n<p>Und eine Schreibfl\u00e4che und zwei Beispiele\t:<\/p>\n<pre class=\"brush: inform7; title: ; notranslate\" title=\"\">A writing-surface is a kind of thing. It has a text called writing. It is usually fixed in place.\r\n\r\nThe blackboard is a writing-surface in the House.  The writing is &quot;e = m c(square).&quot;\r\n\r\nThe notepad is a writing-surface in the House. It is portable. \r\n<\/pre>\n<p>Man kann bei der Definition neuer Klassen auch Vorgaben f\u00fcr beliebige Attribute machen: it is never edible oder it is always portable oder it is usually not scenery. Wenn etwas <code>always<\/code> oder <code>never<\/code> der Fall ist, kann man das bei den Objekten sp\u00e4ter nicht \u00e4ndern, wenn etwas <code>usually<\/code> so ist, dann gilt das f\u00fcr neue Objekte so lange, bis man etwas anderes festlegt.<\/p>\n<p>Sinn machen Attribute nur, wenn sie bei Methoden ber\u00fccksichtigt werden. Inform 7 behandelt dieses Konzept allerdings auf ungewohnte Weise.<\/p>\n<p><a href=\"https:\/\/herr-rau.de\/blogs\/inform\/files\/Vererbung.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/herr-rau.de\/blogs\/inform\/files\/Vererbung.png\" alt=\"\" title=\"Vererbung\" width=\"791\" height=\"444\" class=\"alignnone size-full wp-image-180\" srcset=\"https:\/\/herr-rau.de\/blogs\/inform\/files\/Vererbung.png 791w, https:\/\/herr-rau.de\/blogs\/inform\/files\/Vererbung-300x168.png 300w, https:\/\/herr-rau.de\/blogs\/inform\/files\/Vererbung-500x280.png 500w\" sizes=\"auto, (max-width: 791px) 100vw, 791px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Inform 7 gibt es keine Mehrfachvererbung, anders als in der zugrunde liegenden Sprache Inform 6. Vererbung geschieht mit dem Schl\u00fcsselwort &#8220;is a kind of&#8221;. Vielleicht soll es in einem Spiel viele B\u00fccher geben, so dass es sich lohnt, eine &hellip; <a href=\"https:\/\/herr-rau.de\/blogs\/inform\/?page_id=103\">Weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":94,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-103","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=\/wp\/v2\/pages\/103","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=103"}],"version-history":[{"count":0,"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=\/wp\/v2\/pages\/103\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=\/wp\/v2\/pages\/94"}],"wp:attachment":[{"href":"https:\/\/herr-rau.de\/blogs\/inform\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}