{"id":4451,"date":"2014-03-30T11:08:10","date_gmt":"2014-03-30T11:08:10","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/polymorphism-and-type-conversion-collection-of-common-programming-errors\/"},"modified":"2014-03-30T11:08:10","modified_gmt":"2014-03-30T11:08:10","slug":"polymorphism-and-type-conversion-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/polymorphism-and-type-conversion-collection-of-common-programming-errors\/","title":{"rendered":"Polymorphism and type conversion-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;m confused about an aspect of polymorphism. Please consider the following code:<\/p>\n<pre><code>#include \n\nclass CBase {\n    virtual void dummy() {}\n};\nclass CDerived: public CBase {\n    public:\n    int a,b,c,d;\n    CDerived (): a(1),b(2),c(3),d(4) { }\n};\nint main () {\n\n    CBase* pba = new CDerived;\n\n    std::cout<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m confused about an aspect of polymorphism. Please consider the following code: #include class CBase { virtual void dummy() {} }; class CDerived: public CBase { public: int a,b,c,d; CDerived (): a(1),b(2),c(3),d(4) { } }; int main () { CBase* pba = new CDerived; std::cout<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4451","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4451","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4451"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4451\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4451"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4451"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4451"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}