{"id":425,"date":"2017-05-16T09:21:00","date_gmt":"2017-05-16T09:21:00","guid":{"rendered":"http:\/\/imalogic.com\/blog\/?p=425"},"modified":"2017-05-16T09:23:25","modified_gmt":"2017-05-16T09:23:25","slug":"the-4-pillars-of-object-oriented-programming","status":"publish","type":"post","link":"https:\/\/imalogic.com\/blog\/2017\/05\/16\/the-4-pillars-of-object-oriented-programming\/","title":{"rendered":"The &#8220;4&#8221; Pillars of Object Oriented Programming"},"content":{"rendered":"<body><p><\/p>\n<header class=\"entry-header\">I have read an article about\u00a0the \u201c4 Pillars\u201d Of Object Oriented Programming but let\u2019s be honest here, I\u00a0tend to forget what are the \u201c4 pillars\u201d of OOP. Limited to only \u201c4 pillards\u201d when each new version of C++ added new features &amp; new ways of programming ?<\/header>\n<div class=\"entry-content\">if you are like me, who tends to use them a lot but always can\u2019t find the words to explain it to friend<br>\nor a colleague then this is something worth your time recalling.\n<h1>So What are the 4 pillars of OOP ?<\/h1>\n<p><strong>Abstraction<\/strong><\/p>\n<p>Abstraction is a process of exposing essential<a href=\"https:\/\/i0.wp.com\/imalogic.com\/blog\/wp-content\/uploads\/2017\/05\/maxresdefault.jpg?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"426\" data-permalink=\"https:\/\/imalogic.com\/blog\/2017\/05\/16\/the-4-pillars-of-object-oriented-programming\/maxresdefault-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/imalogic.com\/blog\/wp-content\/uploads\/2017\/05\/maxresdefault.jpg?fit=1280%2C720&amp;ssl=1\" data-orig-size=\"1280,720\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"maxresdefault\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/imalogic.com\/blog\/wp-content\/uploads\/2017\/05\/maxresdefault.jpg?fit=810%2C456&amp;ssl=1\" class=\"size-medium wp-image-426 alignright\" src=\"https:\/\/i0.wp.com\/imalogic.com\/blog\/wp-content\/uploads\/2017\/05\/maxresdefault.jpg?resize=300%2C169&#038;ssl=1\" alt=\"\" width=\"300\" height=\"169\" loading=\"lazy\" srcset=\"https:\/\/i0.wp.com\/imalogic.com\/blog\/wp-content\/uploads\/2017\/05\/maxresdefault.jpg?resize=300%2C169&amp;ssl=1 300w, https:\/\/i0.wp.com\/imalogic.com\/blog\/wp-content\/uploads\/2017\/05\/maxresdefault.jpg?resize=768%2C432&amp;ssl=1 768w, https:\/\/i0.wp.com\/imalogic.com\/blog\/wp-content\/uploads\/2017\/05\/maxresdefault.jpg?resize=1024%2C576&amp;ssl=1 1024w, https:\/\/i0.wp.com\/imalogic.com\/blog\/wp-content\/uploads\/2017\/05\/maxresdefault.jpg?w=1280&amp;ssl=1 1280w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>\u00a0feature of an entity while hiding other irrelevant detail. Why would you want to use abstraction?<br>\n<em>abstraction reduces code complexity and at the same time it makes your aesthetically pleasant.<\/em><\/p>\n<p><strong>Encapsulation<\/strong><\/p>\n<p>We have to take in consideration that Encapsulation is somehow related to Data Hiding.<br>\nEncapsulation is when you hide your modules internal data and all other implementation details\/mechanism from other modules.<br>\nit is also a way of restricting access to certain properties or component.<br>\n<em>Remember, Encapsulation is not data hiding, but Encapsulation leads to data hiding<\/em><\/p>\n<p><strong>Inheritance<\/strong><br>\n<em>The ability of creating a new class\u00a0<\/em><em>from an existing class.<\/em><\/p>\n<p>Like the word Inheritance literally means it is a practice of passing on property, titles, debts, rights and obligations upon the death of an individual. In OOP this is somehow true(Except the death of an individual), where The base class(the existing class sometimes called as the Parent class) has properties and methods that will be inherited by the sub class(sometimes called a subtype or child class) and <em>it can have additional properties<\/em>\u00a0<em>or methods.\u00a0<\/em>Inheritance is also a way to use code of an existing objects.<\/p>\n<p><strong>Polymorphism<\/strong><br>\nJust like in biology, Polymorphism refers to the ability to take into different forms or stages.A subclass can define its own unique behaviour and still share the same functionalities or behavior of its<br>\nparent\/base class. Yes, you got it right, subclass can have their own behavior and share<br>\nsome behaviour from its parent class But, not vice versa. A parent class cannot have the behaviour<br>\nof its subclass.<\/p>\n<p>This is enough for you to recall everything you have forgotten about the pillars of OOP ;-p<\/p>\n<\/div>\n<p><\/p>\n<\/body>","protected":false},"excerpt":{"rendered":"<p>I have read an article about\u00a0the \u201c4 Pillars\u201d Of Object Oriented Programming but let\u2019s be honest here, I\u00a0tend to forget<\/p>\n","protected":false},"author":1,"featured_media":426,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[7],"tags":[],"class_list":["post-425","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-coding"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/imalogic.com\/blog\/wp-content\/uploads\/2017\/05\/maxresdefault.jpg?fit=1280%2C720&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8J21V-6R","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/imalogic.com\/blog\/wp-json\/wp\/v2\/posts\/425","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/imalogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/imalogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/imalogic.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/imalogic.com\/blog\/wp-json\/wp\/v2\/comments?post=425"}],"version-history":[{"count":1,"href":"https:\/\/imalogic.com\/blog\/wp-json\/wp\/v2\/posts\/425\/revisions"}],"predecessor-version":[{"id":429,"href":"https:\/\/imalogic.com\/blog\/wp-json\/wp\/v2\/posts\/425\/revisions\/429"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/imalogic.com\/blog\/wp-json\/wp\/v2\/media\/426"}],"wp:attachment":[{"href":"https:\/\/imalogic.com\/blog\/wp-json\/wp\/v2\/media?parent=425"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/imalogic.com\/blog\/wp-json\/wp\/v2\/categories?post=425"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/imalogic.com\/blog\/wp-json\/wp\/v2\/tags?post=425"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}