{"id":2566,"date":"2021-08-27T00:13:17","date_gmt":"2021-08-27T00:13:17","guid":{"rendered":"https:\/\/www.wikitechy.com\/interview-questions\/?p=2566"},"modified":"2021-09-03T09:20:12","modified_gmt":"2021-09-03T09:20:12","slug":"how-will-a-class-protect-the-code-inside-it","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/interview-questions\/programming\/how-will-a-class-protect-the-code-inside-it\/","title":{"rendered":"How will a class protect the code inside it ?"},"content":{"rendered":"<div class=\"TextHeading\">\n<div class=\"hddn\">\n<p class=\"color-pink\">How will a class protect the code inside it ?<\/p>\n<div class=\"row\">\n<div class=\"col-sm-6\">\n<p>A. Using access specifier<\/p>\n<\/div>\n<div class=\"col-sm-6\">\n<p>B. Abstraction<\/p>\n<\/div>\n<div class=\"col-sm-6\">\n<p>C. Use of inheritance<\/p>\n<\/div>\n<div class=\"col-sm-6\">\n<p>D. All of the mentioned<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3 id=\"answer-a-using-access-specifier\"><b>Answer :\u00a0<\/b>A. Using access specifier<\/h3>\n<div class=\"subheading\">\n<h2 id=\"explanation\">Explanation :<\/h2>\n<\/div>\n<div class=\"Content\">\n<div class=\"hddn\">\n<ul>\n<li><b>Public<\/b>\u00a0\u2013 The members declared as Public are accessible from outside the Class through an object of the class.<\/li>\n<li><b>Protected<\/b>\u00a0\u2013 The members declared as Protected are accessible from outside the class but only in a class derived from it.<\/li>\n<li><b>Private<\/b>\u00a0\u2013 These members are only accessible from within the class. No outside Access is allowed.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Answer :\u00a0A. Using access specifier<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15949],"tags":[15966,2329,15967,15950,15951,2325,15952,15953,15968,15963,15954,16276,15955,15956,15957,15958,15959,15960,15964,15969,15961,15965,15962],"class_list":["post-2566","post","type-post","status-publish","format-standard","hentry","category-programming","tag-access-specifier","tag-access-specifier-in-c","tag-access-specifier-in-class","tag-access-specifiers-in-c-mcq","tag-access-specifiers-in-c","tag-access-specifiers-in-c-with-examples","tag-access-specifiers-in-java","tag-encapsulation-is-also-responsible-for-security-and-diversity-in-java","tag-functions-of-access-specifier","tag-how-will-a-class-protect-the-code-inside-it","tag-inheritance-and-access-specifiers","tag-most-asked-sapient-nitro-interview-questions","tag-object-oriented-programming-exam-questions-and-answers","tag-object-oriented-programming-in-java-mcq-with-answers","tag-object-oriented-programming-in-java-questions-and-answers","tag-object-oriented-programming-mcq-with-answers","tag-object-oriented-programming-questions-and-answers","tag-oop-mcqs-test","tag-protected-class","tag-uses-of-access-specifier-in-class","tag-what-are-the-access-specifiers","tag-what-is-protected-class","tag-what-is-protected-in-oop"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How will a class protect the code inside it ? - Programming - Wikitechy<\/title>\n<meta name=\"description\" content=\"How will a class protect the code inside it ? - Using access specifier. The members declared as Public are accessible from outside the Class through an object of the class.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wikitechy.com\/interview-questions\/programming\/how-will-a-class-protect-the-code-inside-it\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How will a class protect the code inside it ? - Programming - Wikitechy\" \/>\n<meta property=\"og:description\" content=\"How will a class protect the code inside it ? - Using access specifier. The members declared as Public are accessible from outside the Class through an object of the class.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/programming\/how-will-a-class-protect-the-code-inside-it\/\" \/>\n<meta property=\"og:site_name\" content=\"Wikitechy\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-27T00:13:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-09-03T09:20:12+00:00\" \/>\n<meta name=\"author\" content=\"Editor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Editor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/programming\\\/how-will-a-class-protect-the-code-inside-it\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/programming\\\/how-will-a-class-protect-the-code-inside-it\\\/\"},\"author\":{\"name\":\"Editor\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/4d5a581fb5470d1560324bddc5e8b757\"},\"headline\":\"How will a class protect the code inside it ?\",\"datePublished\":\"2021-08-27T00:13:17+00:00\",\"dateModified\":\"2021-09-03T09:20:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/programming\\\/how-will-a-class-protect-the-code-inside-it\\\/\"},\"wordCount\":95,\"commentCount\":0,\"keywords\":[\"access specifier\",\"access specifier in c++\",\"access specifier in class\",\"access specifiers in c# mcq\",\"access specifiers in c++\",\"access specifiers in c++ with examples\",\"access specifiers in java\",\"encapsulation is also responsible for security and diversity in java\",\"functions of access specifier\",\"How will a class protect the code inside it\",\"Inheritance and access specifiers\",\"Most Asked Sapient Nitro Interview Questions\",\"object oriented programming exam questions and answers\",\"object oriented programming in java mcq with answers\",\"object oriented programming in java questions and answers\",\"object oriented programming mcq with answers\",\"object oriented programming questions and answers\",\"oop mcqs test\",\"protected class\",\"uses of access specifier in class\",\"What are the access specifiers\",\"what is protected class\",\"What is protected in OOP\"],\"articleSection\":[\"Programming\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/programming\\\/how-will-a-class-protect-the-code-inside-it\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/programming\\\/how-will-a-class-protect-the-code-inside-it\\\/\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/programming\\\/how-will-a-class-protect-the-code-inside-it\\\/\",\"name\":\"How will a class protect the code inside it ? - Programming - Wikitechy\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#website\"},\"datePublished\":\"2021-08-27T00:13:17+00:00\",\"dateModified\":\"2021-09-03T09:20:12+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/4d5a581fb5470d1560324bddc5e8b757\"},\"description\":\"How will a class protect the code inside it ? - Using access specifier. The members declared as Public are accessible from outside the Class through an object of the class.\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/programming\\\/how-will-a-class-protect-the-code-inside-it\\\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#website\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/\",\"name\":\"Wikitechy\",\"description\":\"Interview Questions\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/4d5a581fb5470d1560324bddc5e8b757\",\"name\":\"Editor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"caption\":\"Editor\"},\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/author\\\/editor\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How will a class protect the code inside it ? - Programming - Wikitechy","description":"How will a class protect the code inside it ? - Using access specifier. The members declared as Public are accessible from outside the Class through an object of the class.","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:\/\/www.wikitechy.com\/interview-questions\/programming\/how-will-a-class-protect-the-code-inside-it\/","og_locale":"en_US","og_type":"article","og_title":"How will a class protect the code inside it ? - Programming - Wikitechy","og_description":"How will a class protect the code inside it ? - Using access specifier. The members declared as Public are accessible from outside the Class through an object of the class.","og_url":"https:\/\/www.wikitechy.com\/interview-questions\/programming\/how-will-a-class-protect-the-code-inside-it\/","og_site_name":"Wikitechy","article_published_time":"2021-08-27T00:13:17+00:00","article_modified_time":"2021-09-03T09:20:12+00:00","author":"Editor","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Editor","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.wikitechy.com\/interview-questions\/programming\/how-will-a-class-protect-the-code-inside-it\/#article","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/programming\/how-will-a-class-protect-the-code-inside-it\/"},"author":{"name":"Editor","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757"},"headline":"How will a class protect the code inside it ?","datePublished":"2021-08-27T00:13:17+00:00","dateModified":"2021-09-03T09:20:12+00:00","mainEntityOfPage":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/programming\/how-will-a-class-protect-the-code-inside-it\/"},"wordCount":95,"commentCount":0,"keywords":["access specifier","access specifier in c++","access specifier in class","access specifiers in c# mcq","access specifiers in c++","access specifiers in c++ with examples","access specifiers in java","encapsulation is also responsible for security and diversity in java","functions of access specifier","How will a class protect the code inside it","Inheritance and access specifiers","Most Asked Sapient Nitro Interview Questions","object oriented programming exam questions and answers","object oriented programming in java mcq with answers","object oriented programming in java questions and answers","object oriented programming mcq with answers","object oriented programming questions and answers","oop mcqs test","protected class","uses of access specifier in class","What are the access specifiers","what is protected class","What is protected in OOP"],"articleSection":["Programming"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.wikitechy.com\/interview-questions\/programming\/how-will-a-class-protect-the-code-inside-it\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.wikitechy.com\/interview-questions\/programming\/how-will-a-class-protect-the-code-inside-it\/","url":"https:\/\/www.wikitechy.com\/interview-questions\/programming\/how-will-a-class-protect-the-code-inside-it\/","name":"How will a class protect the code inside it ? - Programming - Wikitechy","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website"},"datePublished":"2021-08-27T00:13:17+00:00","dateModified":"2021-09-03T09:20:12+00:00","author":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757"},"description":"How will a class protect the code inside it ? - Using access specifier. The members declared as Public are accessible from outside the Class through an object of the class.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wikitechy.com\/interview-questions\/programming\/how-will-a-class-protect-the-code-inside-it\/"]}]},{"@type":"WebSite","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website","url":"https:\/\/www.wikitechy.com\/interview-questions\/","name":"Wikitechy","description":"Interview Questions","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wikitechy.com\/interview-questions\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757","name":"Editor","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","caption":"Editor"},"url":"https:\/\/www.wikitechy.com\/interview-questions\/author\/editor\/"}]}},"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/2566","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/comments?post=2566"}],"version-history":[{"count":1,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/2566\/revisions"}],"predecessor-version":[{"id":2576,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/2566\/revisions\/2576"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/media?parent=2566"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/categories?post=2566"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/tags?post=2566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}