{"id":170,"date":"2015-06-18T04:31:08","date_gmt":"2015-06-18T00:31:08","guid":{"rendered":"http:\/\/courses.haigarmen.com\/creativecoding\/?p=170"},"modified":"2015-06-18T04:42:21","modified_gmt":"2015-06-18T00:42:21","slug":"classes-instances-of-dogs","status":"publish","type":"post","link":"https:\/\/courses.haigarmen.com\/creativecoding\/classes-instances-of-dogs\/","title":{"rendered":"Classes &#038; Instances of Dogs"},"content":{"rendered":"<p>To illustrate the difference between a class and an instance let&#8217;s take a look at applying the concept to dogs.<\/p>\n<p><strong>Class<\/strong><br \/>\nA class is a definition for a collection of objects. For example, if we define a class for Dogs it would include all the characteristics common to all dogs.<br \/>\nThe class is a template: it defines only the parameters these objects share, functions they can perform, and logic for how an object can be constructed. A class becomes an object only when you make an instance of it.<\/p>\n<p>Let&#8217;s try to make a Dog Class<\/p>\n<p>All Dogs have:<\/p>\n<ul>\n<li> name<\/li>\n<li> breed<\/li>\n<li> hair<\/li>\n<li> legs (usually 4)<\/li>\n<li> head<\/li>\n<li> tail (most of them)<\/li>\n<\/ul>\n<p>All Dogs can:<\/p>\n<ul>\n<li>bark<\/li>\n<li>run<\/li>\n<li>eat<\/li>\n<\/ul>\n<p>Now let&#8217;s make a few instances of dogs<br \/>\n<strong>Instance 1: Pluto<\/strong><\/p>\n<ul>\n<li> name = Pluto<\/li>\n<li> breed = Bloodhound<\/li>\n<li> hair = short and light brown<\/li>\n<li> legs = 4<\/li>\n<li> head = large<\/li>\n<li> tail = yes<\/li>\n<li>bark = a lot<\/li>\n<li>run = fast<\/li>\n<li>eat = cheeseburgers<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>To illustrate the difference between a class and an instance let&#8217;s take a look at applying the concept to dogs. Class A class is a definition for a collection of objects. For example, if we define a class for Dogs it would include all the characteristics common to all dogs. The class is a template: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-170","post","type-post","status-publish","format-standard","hentry","category-reading"],"_links":{"self":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/170","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/comments?post=170"}],"version-history":[{"count":5,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/170\/revisions"}],"predecessor-version":[{"id":173,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/posts\/170\/revisions\/173"}],"wp:attachment":[{"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/media?parent=170"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/categories?post=170"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.haigarmen.com\/creativecoding\/wp-json\/wp\/v2\/tags?post=170"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}