{"id":20072,"date":"2021-09-22T19:50:03","date_gmt":"2021-09-22T14:20:03","guid":{"rendered":"https:\/\/tutorial.eyehunts.com\/?p=20072"},"modified":"2022-07-15T08:01:03","modified_gmt":"2022-07-15T02:31:03","slug":"constructor-overloading-in-python-example-code","status":"publish","type":"post","link":"https:\/\/tutorial.eyehunts.com\/python\/constructor-overloading-in-python-example-code\/","title":{"rendered":"Constructor overloading in Python | Example code"},"content":{"rendered":"\n<p>Constructor overloading means more than one <em>constructor<\/em> in a class with the same name but a different argument (parameter). Python does not support Constructor overloading; it has no form of function.<\/p>\n\n\n\n<p>In Python, Methods are defined solely by their name, and there can be only one method per class with a given name.<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Example constructor overloading in Python<\/strong><\/h2>\n\n\n\n<p>Simple example code to achieve constructor overloading based on args.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Example:\n\n    # constructor overloading based on args\n    def __init__(self, *args):\n\n        # if args are more than 1 sum of args\n        if len(args) &gt; 1:\n            self.answer = 0\n            for i in args:\n                self.answer += i\n\n        # if arg is an integer square the arg\n        elif isinstance(args&#91;0], int):\n            self.answer = args&#91;0] * args&#91;0]\n\n        # if arg is string Print with hello\n        elif isinstance(args&#91;0], str):\n            self.answer = \"Hello! \" + args&#91;0] + \".\"\n\n\ne1 = Example(1, 2, 3, 6, 8)\nprint(\"Sum :\", e1.answer)\n\ne2 = Example(6)\nprint(\"Square :\", e2.answer)\n\ne3 = Example(\"Python\")\nprint(\"String :\", e3.answer)\n<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong>:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"323\" height=\"162\" src=\"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/09\/Constructor-overloading-in-Python.jpg?resize=323%2C162&#038;ssl=1\" alt=\"Constructor overloading in Python\" class=\"wp-image-20219\"\/><\/figure><\/div>\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Constructor overloading in python with default arguments<\/strong><\/h3>\n\n\n\n<p>Python does not support <a href=\"https:\/\/tutorial.eyehunts.com\/python\/python-multiple-constructors-example-code\/\">multiple constructors<\/a>. However, you can emulate them easily as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class MyClass:\n    def __init__(self, edate=None, fdate=\"\"):\n        if edate:\n            print(\"Constructors\", edate)\n        else:\n            print(\"Default Constructor\")\n\n\nobj1 = MyClass(\"01-Dec-2021\")\n\nobj2 = MyClass()\n<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong>:<\/p>\n\n\n\n<p>Constructors 01-Dec-2021<br>Default Constructor<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>How to overload __init__ method based on argument type?<\/strong><\/h3>\n\n\n\n<p><strong>Answer<\/strong>: Do get &#8216;alternate constructors&#8217; is to use classmethods. For instance:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class MyData:\n    def __init__(self, data):\n        self.data = data\n\n    @classmethod\n    def fromfilename(cls, filename):\n        data = open(filename).readlines()\n        return cls(data)\n\n    @classmethod\n    def fromdict(cls, datadict):\n        MyData(&#91;1, 2, 3]).data\n        return cls(datadict.items())\n\n\nprint(MyData.fromfilename(\"file.txt\").data)\n\nprint(MyData.fromdict({\"spam\": \"ham\"}).data)\n<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong>: <\/p>\n\n\n\n<p>[&#8216;Welcome Developer&#8217;]<br>dict_items([(&#8216;spam&#8217;, &#8216;ham&#8217;)])<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p><strong>Source<\/strong>: stackoverflow.com\/<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Do comment if you have any doubts or suggestions on this Python constructor tutorial.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Note:<\/strong> IDE:&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/www.jetbrains.com\/pycharm\/\" target=\"_blank\">PyCharm<\/a>&nbsp;2021.3.3 (Community Edition)<\/p><p>Windows 10<\/p><p><strong>Python 3.10.1<\/strong><\/p><p>All<strong>&nbsp;Python Examples&nbsp;are in&nbsp;Python&nbsp;3<\/strong>, so Maybe its different from python 2 or upgraded versions.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Constructor overloading means more than one constructor in a class with the same name but a different argument (parameter). Python does not support Constructor overloading; it has no form of function. In Python, Methods are defined solely by their name, and there can be only one method per class with a given name. Example constructor&hellip;&nbsp;<a href=\"https:\/\/tutorial.eyehunts.com\/python\/constructor-overloading-in-python-example-code\/\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">Constructor overloading in Python | Example code<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","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":""},"categories":[30],"tags":[210],"post_series":[],"class_list":["post-20072","post","type-post","status-publish","format-standard","hentry","category-python","tag-python-constructor"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.1.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Constructor overloading in Python | Example code<\/title>\n<meta name=\"description\" content=\"Constructor overloading means more than one constructor in a class with the same name but a different argument (parameter). Python does not..\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/tutorial.eyehunts.com\/python\/constructor-overloading-in-python-example-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Constructor overloading in Python | Example code\" \/>\n<meta property=\"og:description\" content=\"Constructor overloading means more than one constructor in a class with the same name but a different argument (parameter). Python does not..\" \/>\n<meta property=\"og:url\" content=\"https:\/\/tutorial.eyehunts.com\/python\/constructor-overloading-in-python-example-code\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorial\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-22T14:20:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-07-15T02:31:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/09\/Constructor-overloading-in-Python.jpg\" \/>\n<meta name=\"author\" content=\"Rohit\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rohit\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/constructor-overloading-in-python-example-code\/\",\"url\":\"https:\/\/tutorial.eyehunts.com\/python\/constructor-overloading-in-python-example-code\/\",\"name\":\"Constructor overloading in Python | Example code\",\"isPartOf\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/constructor-overloading-in-python-example-code\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/constructor-overloading-in-python-example-code\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/09\/Constructor-overloading-in-Python.jpg\",\"datePublished\":\"2021-09-22T14:20:03+00:00\",\"dateModified\":\"2022-07-15T02:31:03+00:00\",\"author\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1\"},\"description\":\"Constructor overloading means more than one constructor in a class with the same name but a different argument (parameter). Python does not..\",\"breadcrumb\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/constructor-overloading-in-python-example-code\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/tutorial.eyehunts.com\/python\/constructor-overloading-in-python-example-code\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/constructor-overloading-in-python-example-code\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/09\/Constructor-overloading-in-Python.jpg?fit=323%2C162&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/09\/Constructor-overloading-in-Python.jpg?fit=323%2C162&ssl=1\",\"width\":323,\"height\":162},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/constructor-overloading-in-python-example-code\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/tutorial.eyehunts.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Constructor overloading in Python | Example code\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/#website\",\"url\":\"https:\/\/tutorial.eyehunts.com\/\",\"name\":\"Tutorial\",\"description\":\"By EyeHunts\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/tutorial.eyehunts.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1\",\"name\":\"Rohit\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777374971\",\"contentUrl\":\"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777374971\",\"caption\":\"Rohit\"},\"description\":\"Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology &amp; like learning technical.\",\"url\":\"https:\/\/tutorial.eyehunts.com\/author\/rohit\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Constructor overloading in Python | Example code","description":"Constructor overloading means more than one constructor in a class with the same name but a different argument (parameter). Python does not..","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:\/\/tutorial.eyehunts.com\/python\/constructor-overloading-in-python-example-code\/","og_locale":"en_US","og_type":"article","og_title":"Constructor overloading in Python | Example code","og_description":"Constructor overloading means more than one constructor in a class with the same name but a different argument (parameter). Python does not..","og_url":"https:\/\/tutorial.eyehunts.com\/python\/constructor-overloading-in-python-example-code\/","og_site_name":"Tutorial","article_published_time":"2021-09-22T14:20:03+00:00","article_modified_time":"2022-07-15T02:31:03+00:00","og_image":[{"url":"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/09\/Constructor-overloading-in-Python.jpg","type":"","width":"","height":""}],"author":"Rohit","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Rohit","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/tutorial.eyehunts.com\/python\/constructor-overloading-in-python-example-code\/","url":"https:\/\/tutorial.eyehunts.com\/python\/constructor-overloading-in-python-example-code\/","name":"Constructor overloading in Python | Example code","isPartOf":{"@id":"https:\/\/tutorial.eyehunts.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/tutorial.eyehunts.com\/python\/constructor-overloading-in-python-example-code\/#primaryimage"},"image":{"@id":"https:\/\/tutorial.eyehunts.com\/python\/constructor-overloading-in-python-example-code\/#primaryimage"},"thumbnailUrl":"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/09\/Constructor-overloading-in-Python.jpg","datePublished":"2021-09-22T14:20:03+00:00","dateModified":"2022-07-15T02:31:03+00:00","author":{"@id":"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1"},"description":"Constructor overloading means more than one constructor in a class with the same name but a different argument (parameter). Python does not..","breadcrumb":{"@id":"https:\/\/tutorial.eyehunts.com\/python\/constructor-overloading-in-python-example-code\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/tutorial.eyehunts.com\/python\/constructor-overloading-in-python-example-code\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tutorial.eyehunts.com\/python\/constructor-overloading-in-python-example-code\/#primaryimage","url":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/09\/Constructor-overloading-in-Python.jpg?fit=323%2C162&ssl=1","contentUrl":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/09\/Constructor-overloading-in-Python.jpg?fit=323%2C162&ssl=1","width":323,"height":162},{"@type":"BreadcrumbList","@id":"https:\/\/tutorial.eyehunts.com\/python\/constructor-overloading-in-python-example-code\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/tutorial.eyehunts.com\/"},{"@type":"ListItem","position":2,"name":"Constructor overloading in Python | Example code"}]},{"@type":"WebSite","@id":"https:\/\/tutorial.eyehunts.com\/#website","url":"https:\/\/tutorial.eyehunts.com\/","name":"Tutorial","description":"By EyeHunts","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/tutorial.eyehunts.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1","name":"Rohit","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/image\/","url":"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777374971","contentUrl":"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777374971","caption":"Rohit"},"description":"Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology &amp; like learning technical.","url":"https:\/\/tutorial.eyehunts.com\/author\/rohit\/"}]}},"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":19919,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-multiple-constructors-example-code\/","url_meta":{"origin":20072,"position":0},"title":"Python multiple constructors | Example code","author":"Rohit","date":"September 20, 2021","format":false,"excerpt":"In Python, you can't define multiple constructors. However, you can define a default value if one is not passed. def __init__(self, city=\"Berlin\"): self.city = city Way to Achieve Multiple Constructors in Python Multiple constructors come to use when a defined class has to perform different functions. You can do Python\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"Python multiple constructors","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/09\/Python-multiple-constructors.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3649,"url":"https:\/\/tutorial.eyehunts.com\/java\/java-overloading-method-overload-example\/","url_meta":{"origin":20072,"position":1},"title":"Java Overloading | Method overloading | Examples","author":"Rohit","date":"December 19, 2018","format":false,"excerpt":"Java Overloading\u00a0is defining two or more methods with the same name. But Method overloading in Java\u00a0has the same name with\u00a0a different number of parameters, different types of parameters, or both.\u00a0 Methods overloading comes under the Polymorphism OOPs Concept. And it's also called compile-time (or static) polymorphism. Syntax The syntax of\u2026","rel":"","context":"In &quot;Java&quot;","block_context":{"text":"Java","link":"https:\/\/tutorial.eyehunts.com\/category\/java\/"},"img":{"alt_text":"Java Overloading, Method overloading Examples constructor rules","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2018\/12\/Java-Overloading-Method-overloading-Examples-constructor-rules.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2018\/12\/Java-Overloading-Method-overloading-Examples-constructor-rules.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2018\/12\/Java-Overloading-Method-overloading-Examples-constructor-rules.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2018\/12\/Java-Overloading-Method-overloading-Examples-constructor-rules.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":3228,"url":"https:\/\/tutorial.eyehunts.com\/java\/java-constructor-default-class-type-example\/","url_meta":{"origin":20072,"position":2},"title":"Java Constructor | Default | Class | Types with Examples","author":"Rohit","date":"November 27, 2018","format":false,"excerpt":"A Java Constructor is a method, it's invoked when a new object of the class has created and memory allocated to the Object. It has the same name as a class name and looks\u00a0similar to a method but without return any value (no return type). This is a java constructor\u00a0definition.\u2026","rel":"","context":"In &quot;Java&quot;","block_context":{"text":"Java","link":"https:\/\/tutorial.eyehunts.com\/category\/java\/"},"img":{"alt_text":"Java Constructor Default Class Types with Examples","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2018\/11\/Java-Constructor-Default-Class-Types-with-Examples.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2018\/11\/Java-Constructor-Default-Class-Types-with-Examples.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2018\/11\/Java-Constructor-Default-Class-Types-with-Examples.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2018\/11\/Java-Constructor-Default-Class-Types-with-Examples.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":20221,"url":"https:\/\/tutorial.eyehunts.com\/python\/constructor-and-destructor-in-python-basics\/","url_meta":{"origin":20072,"position":3},"title":"Constructor and destructor in Python | Basics","author":"Rohit","date":"October 5, 2021","format":false,"excerpt":"Python Constructor is the special function that is automatically executed when an object of a class is created. Python __init__ function is to act as a Constructor. def __init__(self, [args \u2026\u2026..]): <statements> Python Destructor is also a special method that gets executed automatically when an object exit from the scope.\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"Constructor and destructor in Python","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/10\/Constructor-and-destructor-in-Python.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3792,"url":"https:\/\/tutorial.eyehunts.com\/java\/final-keyword-in-java-variable-method-class-example\/","url_meta":{"origin":20072,"position":4},"title":"Final keyword in Java | Variable, Method, Class with examples","author":"Rohit","date":"July 9, 2019","format":false,"excerpt":"The final keyword in java is used to create a Constant Variable, Prevent method overloading and prevent Class Inheritance, etc. Java Final keyword restrict to the user and it can apply\u00a0only to: - VariablesMethodsand Class Java Final Variable Defining a variable as a Final makes it constant, which means you\u2026","rel":"","context":"In &quot;Java&quot;","block_context":{"text":"Java","link":"https:\/\/tutorial.eyehunts.com\/category\/java\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2019\/07\/Final-keyword-in-Java-Variable-Method-Class.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2019\/07\/Final-keyword-in-Java-Variable-Method-Class.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2019\/07\/Final-keyword-in-Java-Variable-Method-Class.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2019\/07\/Final-keyword-in-Java-Variable-Method-Class.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":29276,"url":"https:\/\/tutorial.eyehunts.com\/js\/javascript-super-keyword-in-class\/","url_meta":{"origin":20072,"position":5},"title":"JavaScript super keyword in Class","author":"Rohit","date":"May 11, 2022","format":false,"excerpt":"The JavaScript super keyword is used to access and call functions on an object's parent. This is mainly used when you have to access a variable, method, or constructor in the base class from the derived class. super(arguments); \/\/ calls the parent constructor (only inside the constructor) super.parentMethod(arguments); \/\/ calls\u2026","rel":"","context":"In &quot;JavaScript&quot;","block_context":{"text":"JavaScript","link":"https:\/\/tutorial.eyehunts.com\/category\/js\/"},"img":{"alt_text":"JavaScript super keyword in Class","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2022\/05\/JavaScript-super-keyword.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/20072","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/comments?post=20072"}],"version-history":[{"count":1,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/20072\/revisions"}],"predecessor-version":[{"id":31448,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/20072\/revisions\/31448"}],"wp:attachment":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/media?parent=20072"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/categories?post=20072"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/tags?post=20072"},{"taxonomy":"post_series","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/post_series?post=20072"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}