{"id":14361,"date":"2022-08-27T10:14:30","date_gmt":"2022-08-27T10:14:30","guid":{"rendered":"http:\/\/www.max-sperling.bplaced.net\/?p=14361"},"modified":"2024-02-18T14:21:39","modified_gmt":"2024-02-18T14:21:39","slug":"qa-programming","status":"publish","type":"post","link":"http:\/\/www.max-sperling.bplaced.net\/?p=14361","title":{"rendered":"Declaration vs. Definition vs. Initialization vs. Instantiation vs. Mutation"},"content":{"rendered":"<pre class=\"brush: cpp; gutter: false; title: ; notranslate\" title=\"\">\r\nclass Counter; \/\/ Declaration (class)\r\n\r\nclass Counter \/\/ Definition (class)\r\n{\r\n  public:\r\n    Counter(); \/\/ Declaration (constructor)\r\n    unsigned addOne(); \/\/ Declaration (method)\r\n  private:\r\n     unsigned m_value; \/\/ Declaration (variable)\r\n};\r\n\r\nCounter::Counter() \/\/ Definition (constructor)\r\n  : m_value(0) \/\/ Initialization (variable)\r\n{}\r\n\r\nunsigned Counter::addOne() \/\/ Definition (method)\r\n{\r\n  return ++m_value; \/\/ Mutation (variable)\r\n}\r\n\r\nint main ()\r\n{\r\n  \/\/ Creation (object) = Declaration and Initialization\r\n  \/\/ Instantiation (class)\r\n  Counter* counter = new Counter();\r\n\r\n  \/\/ Destruction (object)\r\n  delete counter;\r\n\r\n  return 0;\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false},"categories":[27],"tags":[],"_links":{"self":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/14361"}],"collection":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=14361"}],"version-history":[{"count":2,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/14361\/revisions"}],"predecessor-version":[{"id":16559,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/14361\/revisions\/16559"}],"wp:attachment":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=14361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=14361"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=14361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}