{"id":688,"date":"2025-05-18T18:45:11","date_gmt":"2025-05-18T18:45:11","guid":{"rendered":"https:\/\/buhave.com\/courses\/?p=688"},"modified":"2026-06-06T14:54:32","modified_gmt":"2026-06-06T14:54:32","slug":"encapsulation","status":"publish","type":"post","link":"https:\/\/buhave.com\/courses\/oop\/encapsulation\/","title":{"rendered":"Encapsulation"},"content":{"rendered":"<h2>Access modifiers (public, private, protected)<\/h2>\n<p>Access modifiers in Object-Oriented Programming control the visibility and accessibility of class members (fields and methods), helping to enforce encapsulation and protect data integrity. For a broad overview, see <a href=\"https:\/\/buhave.com\/courses\/oop\/introduction-to-oop\/\">Introduction to OOP<\/a>.<\/p>\n<h3>Public<\/h3>\n<ul>\n<li>Members declared as public are accessible from anywhere in the program<\/li>\n<li>They can be accessed by other classes, subclasses, and even outside the package or module<\/li>\n<li>Use public when you want to expose functionality or data to other parts of the application<\/li>\n<\/ul>\n<p>Public interfaces define how other parts of the program interact with a class, a concept you can explore in <a href=\"https:\/\/buhave.com\/courses\/oop\/classes-and-objects\/\">Classes and Objects<\/a>.<\/p>\n<h3>Private<\/h3>\n<ul>\n<li>Members marked private are accessible only within the class where they are defined<\/li>\n<li>This is used to restrict access to sensitive data or internal logic<\/li>\n<li>Private fields and methods help enforce encapsulation by hiding internal implementation details<\/li>\n<\/ul>\n<h3>Protected<\/h3>\n<ul>\n<li>Members with protected access are visible within the same class, its subclasses, and sometimes within the same package\/module (language-dependent)<\/li>\n<li>Protected is used when you want to allow inherited classes to access or modify members while still limiting external access<\/li>\n<\/ul>\n<p><strong>Why Use Access Modifiers<\/strong><\/p>\n<ul>\n<li>They enforce clear boundaries between the internal and external parts of a class<\/li>\n<li>They reduce the risk of accidental changes to critical data<\/li>\n<li>They improve code maintainability, security, and reusability<\/li>\n<\/ul>\n<p>Access modifiers are essential tools for controlling access levels in a class, promoting safe coding practices, and supporting object-oriented principles like encapsulation and abstraction.<\/p>\n<h2>Getters and setters<\/h2>\n<p>Getters and setters are special methods used in Object-Oriented Programming to access and modify the private fields of a class while preserving encapsulation and data integrity.<\/p>\n<h3>Getters<\/h3>\n<ul>\n<li>A getter is a method that retrieves or returns the value of a private field<\/li>\n<li>It allows controlled read access to internal class data from outside the class<\/li>\n<li>Getters are typically named with a prefix like get followed by the field name (e.g., getname())<\/li>\n<li>They can also perform additional logic before returning the value, such as formatting or validation<\/li>\n<\/ul>\n<p>For design patterns that enforce a clean separation of concerns, see <a href=\"https:\/\/buhave.com\/courses\/oop\/abstraction\/\">Abstraction<\/a>.<\/p>\n<h3>Setters<\/h3>\n<ul>\n<li>A setter is a method that updates or sets the value of a private field<\/li>\n<li>It enables controlled write access to class data from outside the class<\/li>\n<li>Setters are usually named with a prefix like set followed by the field name (e.g., setname(value))<\/li>\n<li>They can include logic to validate or restrict changes to ensure data consistency<\/li>\n<\/ul>\n<p><strong>Why Use Getters and Setters<\/strong><\/p>\n<ul>\n<li>They help enforce encapsulation by hiding direct access to internal fields<\/li>\n<li>They provide a controlled interface to read and update values safely<\/li>\n<li>They allow future changes in logic without affecting external code that uses the class<\/li>\n<li>They can include checks, transformations, or triggers that execute automatically when data is accessed or changed<\/li>\n<\/ul>\n<p><strong>Example Behavior<\/strong><\/p>\n<ul>\n<li>A private field salary can be accessed using getsalary() and updated with setsalary()<\/li>\n<li>The setter might include a rule to prevent setting a negative salary<\/li>\n<li>The getter might format the salary as currency before returning it<\/li>\n<\/ul>\n<p>Using getters and setters ensures robust, maintainable, and secure object-oriented design by controlling how class data is accessed and modified.<\/p>\n<h2>Data hiding and information security<\/h2>\n<p>Data hiding and information security are core principles of Object-Oriented Programming aimed at protecting internal object data and maintaining application integrity through controlled access mechanisms.<\/p>\n<h3>What is Data Hiding?<\/h3>\n<ul>\n<li>Data hiding refers to restricting direct access to an object&#8217;s internal state (its fields)<\/li>\n<li>It is achieved by making class fields private and exposing them through controlled methods like getters and setters<\/li>\n<li>This ensures that data cannot be accidentally or maliciously modified from outside the class<\/li>\n<\/ul>\n<h3>Role in Information Security<\/h3>\n<ul>\n<li>By hiding data, developers limit the exposure of sensitive information and prevent unintended interactions<\/li>\n<li>It prevents unauthorized access, reducing vulnerabilities in the code<\/li>\n<li>Validations within setter methods can block invalid or harmful inputs, further securing the application<\/li>\n<\/ul>\n<p><strong>Benefits of Data Hiding<\/strong><\/p>\n<ul>\n<li>Improves code reliability by minimizing errors due to unintended changes<\/li>\n<li>Enhances maintainability by clearly defining boundaries for data access<\/li>\n<li>Supports abstraction, allowing complex internal workings to be hidden while exposing only essential features<\/li>\n<li>Encourages encapsulated and modular design<\/li>\n<\/ul>\n<p><strong>Implementation Techniques<\/strong><\/p>\n<ul>\n<li>Use access modifiers like private or protected for fields<\/li>\n<li>Provide public getter and setter methods with validation logic<\/li>\n<li>Apply security best practices such as input sanitization and proper error handling within accessors<\/li>\n<\/ul>\n<p>Data hiding plays a vital role in software security by ensuring that critical data is accessed only through well-defined, secure interfaces. It supports the broader goal of information security by protecting object integrity and reducing exposure to potential threats.<\/p>\n<h2>Example: designing a class with encapsulation<\/h2>\n<p>Encapsulation is a fundamental concept in Object-Oriented Programming that involves bundling data (fields) and methods (functions) within a class while restricting direct access to some of the object\u2019s components to protect its internal state.<\/p>\n<h3>Purpose of Encapsulation<\/h3>\n<ul>\n<li>Protects object data from unauthorized access and modification<\/li>\n<li>Enforces a controlled way to interact with an object using methods<\/li>\n<li>Promotes modular and maintainable code<\/li>\n<\/ul>\n<p><strong>Class Design Example<\/strong><\/p>\n<ul>\n<li>Class Name: bank account<\/li>\n<li>Private Fields: account number, owner name, balance<\/li>\n<li>Public Methods:<\/li>\n<\/ul>\n<p>Learn more about how to structure a class in <a href=\"https:\/\/buhave.com\/courses\/oop\/classes-and-objects\/\">Classes and Objects<\/a>.<\/p>\n<p><strong>Encapsulation in Action<\/strong><\/p>\n<ul>\n<li>All fields are private, so they cannot be accessed directly from outside the class<\/li>\n<li>Methods handle all interactions with the object\u2019s state<\/li>\n<li>Validations inside methods prevent invalid operations (like negative deposits or over-withdrawals)<\/li>\n<\/ul>\n<p><strong>Benefits of This Approach<\/strong><\/p>\n<ul>\n<li>Internal state is secure and consistent<\/li>\n<li>Code is easier to debug and extend<\/li>\n<li>Users of the class don\u2019t need to know how data is managed internally<\/li>\n<\/ul>\n<p>This design demonstrates proper encapsulation by ensuring that data is hidden and accessed only through well-defined, secure methods. It improves maintainability, security, and reliability in object-oriented software development. For a broader overview of OOP concepts, see our Object-Oriented Programming course.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Access modifiers (public, private, protected) Access modifiers in Object-Oriented Programming control the visibility and accessibility of class members (fields and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":690,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[14],"tags":[],"class_list":["post-688","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oop"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Encapsulation - OOP Course<\/title>\n<meta name=\"description\" content=\"Encapsulation is the concept of bundling data and methods together while restricting direct access to some components.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/buhave.com\/courses\/oop\/encapsulation\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Encapsulation - OOP Course\" \/>\n<meta property=\"og:description\" content=\"Encapsulation is the concept of bundling data and methods together while restricting direct access to some components.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/buhave.com\/courses\/oop\/encapsulation\/\" \/>\n<meta property=\"og:site_name\" content=\"BUHAVE\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/BeYouHave\/\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/naveedsafdarawan\/\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-18T18:45:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-06-06T14:54:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/buhave.com\/courses\/wp-content\/uploads\/2025\/05\/Encapsulation.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Naveed Safdar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Naveed Safdar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/oop\\\/encapsulation\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/oop\\\/encapsulation\\\/\"},\"author\":{\"name\":\"Naveed Safdar\",\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/#\\\/schema\\\/person\\\/04fe0254e118521c9fbb3da39de5acca\"},\"headline\":\"Encapsulation\",\"datePublished\":\"2025-05-18T18:45:11+00:00\",\"dateModified\":\"2026-06-06T14:54:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/oop\\\/encapsulation\\\/\"},\"wordCount\":957,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/oop\\\/encapsulation\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/buhave.com\\\/courses\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/Encapsulation.webp\",\"articleSection\":[\"OOP Course\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/buhave.com\\\/courses\\\/oop\\\/encapsulation\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/oop\\\/encapsulation\\\/\",\"url\":\"https:\\\/\\\/buhave.com\\\/courses\\\/oop\\\/encapsulation\\\/\",\"name\":\"Encapsulation - OOP Course\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/oop\\\/encapsulation\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/oop\\\/encapsulation\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/buhave.com\\\/courses\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/Encapsulation.webp\",\"datePublished\":\"2025-05-18T18:45:11+00:00\",\"dateModified\":\"2026-06-06T14:54:32+00:00\",\"description\":\"Encapsulation is the concept of bundling data and methods together while restricting direct access to some components.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/oop\\\/encapsulation\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/buhave.com\\\/courses\\\/oop\\\/encapsulation\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/oop\\\/encapsulation\\\/#primaryimage\",\"url\":\"https:\\\/\\\/buhave.com\\\/courses\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/Encapsulation.webp\",\"contentUrl\":\"https:\\\/\\\/buhave.com\\\/courses\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/Encapsulation.webp\",\"width\":1200,\"height\":628,\"caption\":\"Encapsulation\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/oop\\\/encapsulation\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Courses\",\"item\":\"https:\\\/\\\/buhave.com\\\/courses\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"OOP Course\",\"item\":\"https:\\\/\\\/buhave.com\\\/courses\\\/learn\\\/oop\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Encapsulation\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/#website\",\"url\":\"https:\\\/\\\/buhave.com\\\/courses\\\/\",\"name\":\"BUHAVE\",\"description\":\"Courses - Learn Online for Free\",\"publisher\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/buhave.com\\\/courses\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/#organization\",\"name\":\"BUHAVE\",\"url\":\"https:\\\/\\\/buhave.com\\\/courses\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/buhave.com\\\/courses\\\/wp-content\\\/uploads\\\/2025\\\/03\\\/buhave-course.webp\",\"contentUrl\":\"https:\\\/\\\/buhave.com\\\/courses\\\/wp-content\\\/uploads\\\/2025\\\/03\\\/buhave-course.webp\",\"width\":375,\"height\":75,\"caption\":\"BUHAVE\"},\"image\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/BeYouHave\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/buhave\",\"https:\\\/\\\/www.youtube.com\\\/@buhave\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/#\\\/schema\\\/person\\\/04fe0254e118521c9fbb3da39de5acca\",\"name\":\"Naveed Safdar\",\"description\":\"I\u2019m Naveed Safdar - SEO Manager with over 10 years of experience in SEO and Digital Marketing. I\u2019ve had the privilege of working with leading national and international companies including Grafdom, PakWheels, Systems Limited, Confiz, Educative, and Dubizzle Labs. My expertise spans technical SEO, content strategy, organic growth, and performance analytics - helping businesses improve visibility, traffic, and ROI.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/naveedsafdar\\\/\",\"https:\\\/\\\/www.facebook.com\\\/naveedsafdarawan\\\/\",\"https:\\\/\\\/www.youtube.com\\\/@naveedsafdar\"],\"url\":\"https:\\\/\\\/buhave.com\\\/courses\\\/author\\\/naveed-safdar\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Encapsulation - OOP Course","description":"Encapsulation is the concept of bundling data and methods together while restricting direct access to some components.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/buhave.com\/courses\/oop\/encapsulation\/","og_locale":"en_US","og_type":"article","og_title":"Encapsulation - OOP Course","og_description":"Encapsulation is the concept of bundling data and methods together while restricting direct access to some components.","og_url":"https:\/\/buhave.com\/courses\/oop\/encapsulation\/","og_site_name":"BUHAVE","article_publisher":"https:\/\/www.facebook.com\/BeYouHave\/","article_author":"https:\/\/www.facebook.com\/naveedsafdarawan\/","article_published_time":"2025-05-18T18:45:11+00:00","article_modified_time":"2026-06-06T14:54:32+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/buhave.com\/courses\/wp-content\/uploads\/2025\/05\/Encapsulation.webp","type":"image\/webp"}],"author":"Naveed Safdar","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Naveed Safdar","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/buhave.com\/courses\/oop\/encapsulation\/#article","isPartOf":{"@id":"https:\/\/buhave.com\/courses\/oop\/encapsulation\/"},"author":{"name":"Naveed Safdar","@id":"https:\/\/buhave.com\/courses\/#\/schema\/person\/04fe0254e118521c9fbb3da39de5acca"},"headline":"Encapsulation","datePublished":"2025-05-18T18:45:11+00:00","dateModified":"2026-06-06T14:54:32+00:00","mainEntityOfPage":{"@id":"https:\/\/buhave.com\/courses\/oop\/encapsulation\/"},"wordCount":957,"commentCount":0,"publisher":{"@id":"https:\/\/buhave.com\/courses\/#organization"},"image":{"@id":"https:\/\/buhave.com\/courses\/oop\/encapsulation\/#primaryimage"},"thumbnailUrl":"https:\/\/buhave.com\/courses\/wp-content\/uploads\/2025\/05\/Encapsulation.webp","articleSection":["OOP Course"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/buhave.com\/courses\/oop\/encapsulation\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/buhave.com\/courses\/oop\/encapsulation\/","url":"https:\/\/buhave.com\/courses\/oop\/encapsulation\/","name":"Encapsulation - OOP Course","isPartOf":{"@id":"https:\/\/buhave.com\/courses\/#website"},"primaryImageOfPage":{"@id":"https:\/\/buhave.com\/courses\/oop\/encapsulation\/#primaryimage"},"image":{"@id":"https:\/\/buhave.com\/courses\/oop\/encapsulation\/#primaryimage"},"thumbnailUrl":"https:\/\/buhave.com\/courses\/wp-content\/uploads\/2025\/05\/Encapsulation.webp","datePublished":"2025-05-18T18:45:11+00:00","dateModified":"2026-06-06T14:54:32+00:00","description":"Encapsulation is the concept of bundling data and methods together while restricting direct access to some components.","breadcrumb":{"@id":"https:\/\/buhave.com\/courses\/oop\/encapsulation\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/buhave.com\/courses\/oop\/encapsulation\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/buhave.com\/courses\/oop\/encapsulation\/#primaryimage","url":"https:\/\/buhave.com\/courses\/wp-content\/uploads\/2025\/05\/Encapsulation.webp","contentUrl":"https:\/\/buhave.com\/courses\/wp-content\/uploads\/2025\/05\/Encapsulation.webp","width":1200,"height":628,"caption":"Encapsulation"},{"@type":"BreadcrumbList","@id":"https:\/\/buhave.com\/courses\/oop\/encapsulation\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Courses","item":"https:\/\/buhave.com\/courses\/"},{"@type":"ListItem","position":2,"name":"OOP Course","item":"https:\/\/buhave.com\/courses\/learn\/oop\/"},{"@type":"ListItem","position":3,"name":"Encapsulation"}]},{"@type":"WebSite","@id":"https:\/\/buhave.com\/courses\/#website","url":"https:\/\/buhave.com\/courses\/","name":"BUHAVE","description":"Courses - Learn Online for Free","publisher":{"@id":"https:\/\/buhave.com\/courses\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/buhave.com\/courses\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/buhave.com\/courses\/#organization","name":"BUHAVE","url":"https:\/\/buhave.com\/courses\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/buhave.com\/courses\/#\/schema\/logo\/image\/","url":"https:\/\/buhave.com\/courses\/wp-content\/uploads\/2025\/03\/buhave-course.webp","contentUrl":"https:\/\/buhave.com\/courses\/wp-content\/uploads\/2025\/03\/buhave-course.webp","width":375,"height":75,"caption":"BUHAVE"},"image":{"@id":"https:\/\/buhave.com\/courses\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/BeYouHave\/","https:\/\/www.linkedin.com\/company\/buhave","https:\/\/www.youtube.com\/@buhave"]},{"@type":"Person","@id":"https:\/\/buhave.com\/courses\/#\/schema\/person\/04fe0254e118521c9fbb3da39de5acca","name":"Naveed Safdar","description":"I\u2019m Naveed Safdar - SEO Manager with over 10 years of experience in SEO and Digital Marketing. I\u2019ve had the privilege of working with leading national and international companies including Grafdom, PakWheels, Systems Limited, Confiz, Educative, and Dubizzle Labs. My expertise spans technical SEO, content strategy, organic growth, and performance analytics - helping businesses improve visibility, traffic, and ROI.","sameAs":["https:\/\/www.linkedin.com\/in\/naveedsafdar\/","https:\/\/www.facebook.com\/naveedsafdarawan\/","https:\/\/www.youtube.com\/@naveedsafdar"],"url":"https:\/\/buhave.com\/courses\/author\/naveed-safdar\/"}]}},"_links":{"self":[{"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/posts\/688","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/comments?post=688"}],"version-history":[{"count":4,"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/posts\/688\/revisions"}],"predecessor-version":[{"id":1182,"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/posts\/688\/revisions\/1182"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/media\/690"}],"wp:attachment":[{"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/media?parent=688"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/categories?post=688"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/tags?post=688"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}