{"id":2089,"date":"2015-01-13T13:15:37","date_gmt":"2015-01-13T11:15:37","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=2089"},"modified":"2015-01-12T13:51:52","modified_gmt":"2015-01-12T11:51:52","slug":"simple-javascript-oop-for-c-java-and-c-developers","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/","title":{"rendered":"Simple JavaScript OOP for C++, Java and C# Developers"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>Most developers are familiar with object-oriented programming and design in languages like Java, C++ and C#. JavaScript, however, does not provide any obvious means to support this kind of object-oriented development. The result is that structured code becomes very hard to write for developers new to the world of JavaScript.<\/p>\n<p>If you have written a few programs in JavaScript and wondered if it&#8217;s possible to add more structure to your programs using object-oriented strategies, this tip is for you. In this post, we will look at the use of a small JavaScript utility that allows us to structure our JavaScript programs in the form of &#8220;classes&#8221; and objects.<\/p>\n<h2>Background<\/h2>\n<p>Traditionally, object-oriented programming relies on creating classes and creating object instances from classes. This approach to OOP was pioneered by a language known as Simula and eventually became the basis of object-oriented programming in popular languages such as C++ and Java.<\/p>\n<p>Object-oriented programming in JavaScript, however, comes from a different OOP paradigm known as prototype-based programming. It was first introduced by the language Self with the aim of solving some problems in class-based programming. This style of programming has no concept of classes, and being very different from the class-based style we&#8217;re usually familiar with, it requires a learning curve.<\/p>\n<p>The utility presented below, however, provides a way to mimic class-based OOP in JavaScript.<\/p>\n<h2>Creating Objects<\/h2>\n<p>First, let&#8217;s look at the basic structure for putting together a class:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">var ClassName = Object.$extend({\r\n        initialize: function () {\r\n            \/\/this is the mandatory constructor. All class members should be initialized here.\r\n            this.publicMember = 'Some value';\r\n            this._privateMember = 'Another value';\r\n        },\r\n        \r\n        publicFunction: function () {\r\n            \/\/Code for a public function.\r\n        },\r\n\r\n        _privateFunction: function () {\r\n            \/\/Code for a private function\r\n        }\r\n    });\r\n\r\n    var anObject = new ClassName();\r\n    anObject.publicFunction();<\/pre>\n<p>New &#8220;classes&#8221; are created by extending the base<br \/>\n<code>Object <\/code>type.<br \/>\n<code>$extend <\/code>is a function that we have created for this purpose.<br \/>\n<code>initialize <\/code>is, by convention, called automatically every time we create a new object and is therefore the constructor. All<br \/>\n<code>private <\/code>and<br \/>\n<code>public <\/code>members should be declared in the<br \/>\n<code>initialize <\/code>function.<\/p>\n<p>It is important to note that the &#8220;<code>private<\/code>&#8221; members shown above are not really private at all. Unfortunately, JavaScript doesn&#8217;t offer a means to easily mark members as private and for that reason we prefix them with an underscore to indicate them as such.<br \/>\n<code>anObject._privateFunction() <\/code>would have worked without any issues, but users of our class should be aware of our convention and not attempt to use it directly as it is prefixed with an underscore.<\/p>\n<h2>A Detailed Example<\/h2>\n<p>The following is an example of an &#8220;<code>Animal<\/code>&#8221; class built using our utility. We will use this class for our examples on inheritance:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\/\/This is a basic 'Animal' class. $extend is a method\r\n    \/\/provided by the utility. To build a new class, we \r\n    \/\/'inherit' from the base Object type\r\n\r\n    var Animal = Object.$extend({\r\n\r\n        \/\/'initialize' is the constructor function for objects\r\n        \/\/of type Animal.\r\n\r\n        initialize: function (gender) {\r\n            \/\/Notice that we declare members _gender and _food in\r\n            \/\/the constructor. Declaring member variables in the\r\n            \/\/constructor is important.\r\n\r\n            this._gender = gender;\r\n            this._foods = &#x5B;];\r\n        },\r\n\r\n        \/\/Simple getter and setter functions for the _gender\r\n        \/\/property\r\n\r\n        getGender: function () { return this._gender; },\r\n        setGender: function (gender) { this._gender = gender; },\r\n\r\n        \/\/This function adds an item to the _food array\r\n\r\n        addFood: function (food) {\r\n            this._foods.push(food);\r\n        },\r\n\r\n        \/\/self-explanatory -- removes an item from the\r\n        \/\/_foods array\r\n\r\n        removeFood: function (food) {\r\n            for (var i = this._foods.length; i--;) {\r\n                if (this._foods&#x5B;i] === food) {\r\n                    this._foods.splice(i, 1);\r\n                    break;\r\n                }\r\n            }\r\n        },\r\n\r\n        \/\/Boolean function to check if this animal will eat a particular type of food.\r\n\r\n        willEat: function (food) {\r\n            for (var i = this._foods.length; i--;) {\r\n                if (this._foods&#x5B;i] === food)\r\n                    return true;\r\n            }\r\n            return false;\r\n        }\r\n    });<\/pre>\n<p>There we have it! A class for creating<br \/>\n<code>Animal <\/code>objects. The following code sample creates<br \/>\n<code>Animal <\/code>objects and shows how they are used:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">var lion = new Animal('male');\r\n    var parrot = new Animal('female');\r\n\r\n    lion.addFood('meat');\r\n    parrot.addFood('fruits');\r\n\r\n    lion.willEat('fruits'); \/\/false\r\n    lion.willEat('meat'); \/\/true\r\n    parrot.willEat('fruits'); \/\/true\r\n\r\n    lion._gender \/\/ 'male'\r\n    \r\n    \/\/Unfortunately, JavaScript doesn't easily support 'private' properties \r\n    \/\/in objects. The _gender property we created is publicly readable and\r\n    \/\/writable. By convention, we prefix 'private' properties and functions\r\n    \/\/with and underscore to indicate them as such.<\/pre>\n<h2>Inheritance<\/h2>\n<p>Just like we created our base<code>Animal <\/code>class by extending the type <code>Object<\/code>, we can create child-classes of the <code>Animal <\/code>class by extending it. The following snippet creates a &#8221; <code>Human<\/code>&#8221; type that inherits from <code>Animal<\/code>.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\/\/Extend the Animal type to create the Human type\r\n    \r\n    var Human = Animal.$extend({\r\n        \r\n        \/\/Constructor for the Human type\r\n        initialize: function (name, gender) {\r\n            \r\n            \/\/Notice the call to the parent constructor below. uber behaves just like\r\n            \/\/super and base in Java and C#. This line will call the parent's\r\n            \/\/initialize function and pass gender to it.\r\n            this.uber('initialize', gender);\r\n\r\n            this._name = name;\r\n\r\n            \/\/These functions were defined in the Animal type\r\n            this.addFood('meat');\r\n            this.addFood('vegetables');\r\n            this.addFood('fruits');\r\n        },\r\n        goVegan: function () {\r\n            this.removeFood('meat');\r\n        },\r\n        \r\n        \/\/Returns something like 'Mr. Crockford'\r\n        nameWithTitle: function () {\r\n            return this._getTitlePrefix() + this._name;\r\n        },\r\n        \r\n        \/\/This function is publicly accessible, but we prefix it with an underscore\r\n        \/\/to mark it as private\/protected\r\n        _getTitlePrefix: function () {\r\n            if (this.getGender() === 'male') return 'Mr. ';\r\n            else return 'Ms. ';\r\n        }\r\n    });<\/pre>\n<p>The new<code>Human <\/code>class can be used as follows:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">var jack = new Human('Jack', 'male');\r\n    var jill = new Human('Jill', 'female');\r\n    jill.goVegan();\r\n    jill.nameWithTitle() + ' eats meat? ' + jill.willEat('meat'); \/\/ Ms. Jill eats meat? false\r\n    jack.nameWithTitle() + ' eats meat? ' + jack.willEat('meat'); \/\/ Mr. Jack eats meat? true<\/pre>\n<p>Notice the use of the &#8220;<code>uber<\/code>&#8221; function in the constructor. Similar to &#8220;<code>base<\/code>&#8221; and &#8220;<code>super<\/code>&#8221; in C# and Java, it can be used to call the base class&#8217;s functions. The next example will show another use of the\u00a0<code>uber <\/code>function.<\/p>\n<p>It is important to note that the base class&#8217;s constructor is automatically called without any arguments (<code>new Animal()<\/code>) while defining the<code>Human <\/code>subtype. We called it the second time using &#8220;<code>uber<\/code>&#8221; to make sure it initializes the properties to proper values. It is important to make sure that the initialize function doesn&#8217;t throw any error if called without any arguments.<\/p>\n<h3>More Inheritance Examples<\/h3>\n<p>The following code shows more examples of using OOP and inheritance using our handy utility:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">var Cat = Animal.$extend({\r\n        initialize: function (gender) {\r\n            this.uber('initialize', gender);\r\n            this.addFood('meat');\r\n        },\r\n        speak: function () {\r\n            return 'purrr';\r\n        }\r\n    });\r\n\r\n    var DomesticCat = Cat.$extend({\r\n        initialize: function (gender) {\r\n            this.uber('initialize', gender);\r\n            this.addFood('orijen');\r\n            this.addFood('whiskas');\r\n        },\r\n        speak: function () {\r\n            return this.uber('speak') + ', meow!';\r\n        }\r\n    });\r\n\r\n    var WildCat = Cat.$extend({\r\n        initialize: function (gender) {\r\n            this.uber('initialize', gender);\r\n        },\r\n        speak: function () {\r\n            return this.uber('speak') + ', growl, snarl!';\r\n        }\r\n    });\r\n\r\n    var kitty = new DomesticCat('female');\r\n    var tiger = new WildCat('male');\r\n    'Domestic cat eats orijen? ' + kitty.willEat('orijen'); \/\/ Domestic cat eats orijen? true\r\n    'What does the domestic cat say? ' + kitty.speak(); \/\/ What does the domestic cat say? purrr, meow!\r\n    'What does the wild cat say? ' + tiger.speak(); \/\/ What does the wild cat say? purr, growl, snarl!<\/pre>\n<h2>Usage<\/h2>\n<p>To use this library, download the code and include\u00a0<em>inherit-min.js<\/em> or\u00a0<em>inherit.js<\/em> in your code.<\/p>\n<h2>History<\/h2>\n<p>A copy of the code is also available on GitHub under the BSD license:<br \/>\n<a href=\"https:\/\/github.com\/maujood\/inherit-js\">OOP in JavaScript: Inherit-js on GitHub<\/a>.<\/p>\n<h2>License<\/h2>\n<p>This article, along with any associated source code and files, is licensed under\u00a0<a href=\"http:\/\/www.opensource.org\/licenses\/bsd-license.php\" rel=\"license\">The BSD License<\/a><\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td><span class=\"reference\">Reference: <\/span><\/td>\n<td><a href=\"http:\/\/ui-programming.blogspot.com\/2015\/01\/simple-javascript-oop-for-c-java-and-c.html\">Simple JavaScript OOP for C++, Java and C# Developers<\/a> from our <a href=\"http:\/\/www.webcodegeeks.com\/wcg\/\">WCG partner<\/a> Great Cristescu at the <a href=\"http:\/\/ui-programming.blogspot.com\/\">ui-programming<\/a> blog.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Most developers are familiar with object-oriented programming and design in languages like Java, C++ and C#. JavaScript, however, does not provide any obvious means to support this kind of object-oriented development. The result is that structured code becomes very hard to write for developers new to the world of JavaScript. If you have written &hellip;<\/p>\n","protected":false},"author":42,"featured_media":920,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[78,77],"class_list":["post-2089","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","tag-cpp","tag-java"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Simple JavaScript OOP for C++, Java and C# Developers - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"Introduction Most developers are familiar with object-oriented programming and design in languages like Java, C++ and C#. JavaScript, however, 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:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Simple JavaScript OOP for C++, Java and C# Developers - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"Introduction Most developers are familiar with object-oriented programming and design in languages like Java, C++ and C#. JavaScript, however, does not\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2015-01-13T11:15:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Great Cristescu\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Great Cristescu\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/\"},\"author\":{\"name\":\"Great Cristescu\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/51523c213a1f3105446faae310c579f3\"},\"headline\":\"Simple JavaScript OOP for C++, Java and C# Developers\",\"datePublished\":\"2015-01-13T11:15:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/\"},\"wordCount\":1210,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg\",\"keywords\":[\"Cpp\",\"Java\"],\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/\",\"name\":\"Simple JavaScript OOP for C++, Java and C# Developers - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg\",\"datePublished\":\"2015-01-13T11:15:37+00:00\",\"description\":\"Introduction Most developers are familiar with object-oriented programming and design in languages like Java, C++ and C#. JavaScript, however, does not\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Simple JavaScript OOP for C++, Java and C# Developers\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/51523c213a1f3105446faae310c579f3\",\"name\":\"Great Cristescu\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/9c1fe78dcf07d2dee959aa2224c27bfce5e7e6f1e53d8bfc253d745c1dd88d49?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/9c1fe78dcf07d2dee959aa2224c27bfce5e7e6f1e53d8bfc253d745c1dd88d49?s=96&d=mm&r=g\",\"caption\":\"Great Cristescu\"},\"sameAs\":[\"http:\/\/ui-programming.blogspot.com\/\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/great-cristescu\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Simple JavaScript OOP for C++, Java and C# Developers - Web Code Geeks - 2026","description":"Introduction Most developers are familiar with object-oriented programming and design in languages like Java, C++ and C#. JavaScript, however, 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:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/","og_locale":"en_US","og_type":"article","og_title":"Simple JavaScript OOP for C++, Java and C# Developers - Web Code Geeks - 2026","og_description":"Introduction Most developers are familiar with object-oriented programming and design in languages like Java, C++ and C#. JavaScript, however, does not","og_url":"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2015-01-13T11:15:37+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg","type":"image\/jpeg"}],"author":"Great Cristescu","twitter_card":"summary_large_image","twitter_creator":"@webcodegeeks","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Great Cristescu","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/"},"author":{"name":"Great Cristescu","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/51523c213a1f3105446faae310c579f3"},"headline":"Simple JavaScript OOP for C++, Java and C# Developers","datePublished":"2015-01-13T11:15:37+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/"},"wordCount":1210,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg","keywords":["Cpp","Java"],"articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/","url":"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/","name":"Simple JavaScript OOP for C++, Java and C# Developers - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg","datePublished":"2015-01-13T11:15:37+00:00","description":"Introduction Most developers are familiar with object-oriented programming and design in languages like Java, C++ and C#. JavaScript, however, does not","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/javascript\/simple-javascript-oop-for-c-java-and-c-developers\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"JavaScript","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/"},{"@type":"ListItem","position":3,"name":"Simple JavaScript OOP for C++, Java and C# Developers"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/51523c213a1f3105446faae310c579f3","name":"Great Cristescu","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/9c1fe78dcf07d2dee959aa2224c27bfce5e7e6f1e53d8bfc253d745c1dd88d49?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9c1fe78dcf07d2dee959aa2224c27bfce5e7e6f1e53d8bfc253d745c1dd88d49?s=96&d=mm&r=g","caption":"Great Cristescu"},"sameAs":["http:\/\/ui-programming.blogspot.com\/"],"url":"https:\/\/www.webcodegeeks.com\/author\/great-cristescu\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/2089","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/42"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=2089"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/2089\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/920"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=2089"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=2089"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=2089"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}