{"id":563,"date":"2012-02-29T13:47:01","date_gmt":"2012-02-29T13:47:01","guid":{"rendered":"http:\/\/www.websitedesignwebsitedevelopment.com\/?p=563"},"modified":"2014-03-19T09:14:04","modified_gmt":"2014-03-19T09:14:04","slug":"multiplication-of-objects-array-based-objects-object-multiply-by-object","status":"publish","type":"post","link":"https:\/\/androidbubble.com\/blog\/website-development\/c\/multiplication-of-objects-array-based-objects-object-multiply-by-object\/","title":{"rendered":"Multiplication of objects, array based objects, object multiply by object"},"content":{"rendered":"<p>#include &lt;cstdlib&gt;<br \/>\n#include &lt;iostream&gt;<\/p>\n<p>using namespace std;<\/p>\n<p>\/\/Objectmultiplication class declaration<br \/>\nclass Objectmultiplication<br \/>\n{<br \/>\nprivate:<br \/>\nint array_integers[10]; \/\/Array declaration<\/p>\n<p>public:<\/p>\n<p>\/\/A default constructor which will initialize all array elements with zero<br \/>\nObjectmultiplication()<br \/>\n{<br \/>\narray_integers[0]=0;<br \/>\narray_integers[1]=0;<br \/>\narray_integers[2]=0;<br \/>\narray_integers[3]=0;<br \/>\narray_integers[4]=0;<br \/>\narray_integers[5]=0;<br \/>\narray_integers[6]=0;<br \/>\narray_integers[7]=0;<br \/>\narray_integers[8]=0;<br \/>\narray_integers[9]=0;<br \/>\n}<\/p>\n<p>\/\/Declaration of setter and getter functions<\/p>\n<p>void setArray1();<br \/>\nvoid setArray2();<br \/>\nvoid getArray();<\/p>\n<p>\/\/An operator overloading function which will overload * operator for this class<\/p>\n<p>Objectmultiplication operator*(Objectmultiplication);<\/p>\n<p>};<\/p>\n<p>Objectmultiplication Objectmultiplication::operator *(Objectmultiplication secondobject)<br \/>\n{<br \/>\nObjectmultiplication multi;<\/p>\n<p>int val=0;<\/p>\n<p>\/\/Multiplying both objects and storing the result of multiplication in third object<\/p>\n<p>while(val&lt;=10)<br \/>\n{<br \/>\nmulti.array_integers[val] = array_integers[val]*secondobject.array_integers[val];<br \/>\nval++;<br \/>\n}<\/p>\n<p>return(multi);<br \/>\n}<\/p>\n<p>void Objectmultiplication::setArray1(void)<br \/>\n{<br \/>\n\/\/Using hard coded values, for first object<br \/>\nint val;<br \/>\nfor(val=0; val&lt;10; val++)<br \/>\n{<br \/>\narray_integers[val] = (val+1);<br \/>\n}<br \/>\n}<\/p>\n<p>void Objectmultiplication::setArray2(void)<br \/>\n{<br \/>\n\/\/Using hard coded values, for second object<br \/>\nint val=10, indexes;<\/p>\n<p>for(indexes=0; indexes&lt;10; indexes++)<br \/>\n{<br \/>\narray_integers[indexes] = val;<br \/>\nval&#8211;;<br \/>\n}<br \/>\n}<\/p>\n<p>void Objectmultiplication::getArray(void)<br \/>\n{<br \/>\nint val;<\/p>\n<p>for(val=0; val&lt;10; val++)<br \/>\ncout &lt;&lt; array_integers[val] &lt;&lt; &#8221; \\n&#8221;;<br \/>\n}<\/p>\n<p>int main()<br \/>\n{<br \/>\n\/\/You are required to create three objects of the same class<br \/>\nObjectmultiplication obj1;<br \/>\nObjectmultiplication obj2;<br \/>\nObjectmultiplication obj3;<\/p>\n<p>\/\/Assigning values to first and second objects through setter functions.<br \/>\n\/\/Using hard coded values.<br \/>\nobj1.setArray1();<\/p>\n<p>obj2.setArray2();<\/p>\n<p>\/\/Multiplying both objects and storing the result of multiplication in third object<br \/>\n\/\/Our program is supporting the statement like a = b * c<br \/>\n\/\/where a, b and c are objects of the same class<\/p>\n<p>obj3 = obj1*obj2;<\/p>\n<p>\/\/Displaying the values of first and second object through getter functions<br \/>\ncout &lt;&lt; &#8220;Object 1 : \\n&#8221;;<br \/>\nobj1.getArray();<\/p>\n<p>cout &lt;&lt; &#8220;\\n&#8221;;<br \/>\ncout &lt;&lt; &#8220;Object 2 : \\n&#8221;;<br \/>\nobj2.getArray();<\/p>\n<p>cout &lt;&lt; &#8220;\\n&#8221;;<br \/>\ncout &lt;&lt; &#8220;Multiplication of both objects : \\n&#8221;;<br \/>\nobj3.getArray();<\/p>\n<p>system(&#8220;PAUSE&#8221;);<br \/>\nreturn EXIT_SUCCESS;<\/p>\n<p>}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>#include &lt;cstdlib&gt; #include &lt;iostream&gt; using namespace std; \/\/Objectmultiplication class declaration class Objectmultiplication { private: int array_integers[10]; \/\/Array declaration public: \/\/A default constructor which will initialize all array elements with zero Objectmultiplication() { array_integers[0]=0; array_integers[1]=0; array_integers[2]=0; array_integers[3]=0; array_integers[4]=0; array_integers[5]=0; array_integers[6]=0; array_integers[7]=0; array_integers[8]=0; array_integers[9]=0; } \/\/Declaration of setter and getter functions void setArray1(); void setArray2(); void getArray(); [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[31],"tags":[],"class_list":["post-563","post","type-post","status-publish","format-standard","hentry","category-c"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Multiplication of objects, array based objects, object multiply by object<\/title>\n<meta name=\"description\" content=\"Multiplication of objects, array based objects, object multiply by object\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/androidbubble.com\/blog\/website-development\/c\/multiplication-of-objects-array-based-objects-object-multiply-by-object\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Multiplication of objects, array based objects, object multiply by object\" \/>\n<meta property=\"og:description\" content=\"Multiplication of objects, array based objects, object multiply by object\" \/>\n<meta property=\"og:url\" content=\"https:\/\/androidbubble.com\/blog\/website-development\/c\/multiplication-of-objects-array-based-objects-object-multiply-by-object\/\" \/>\n<meta property=\"og:site_name\" content=\"AndroidBubble Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/pages\/Website-Design-Website-Development\/172363336135453\" \/>\n<meta property=\"article:published_time\" content=\"2012-02-29T13:47:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-03-19T09:14:04+00:00\" \/>\n<meta name=\"author\" content=\"Fahad\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fahad\" \/>\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\":\"Article\",\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/c\/multiplication-of-objects-array-based-objects-object-multiply-by-object\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/c\/multiplication-of-objects-array-based-objects-object-multiply-by-object\/\"},\"author\":{\"name\":\"Fahad\",\"@id\":\"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7\"},\"headline\":\"Multiplication of objects, array based objects, object multiply by object\",\"datePublished\":\"2012-02-29T13:47:01+00:00\",\"dateModified\":\"2014-03-19T09:14:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/c\/multiplication-of-objects-array-based-objects-object-multiply-by-object\/\"},\"wordCount\":316,\"articleSection\":[\"C++\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/c\/multiplication-of-objects-array-based-objects-object-multiply-by-object\/\",\"url\":\"https:\/\/androidbubble.com\/blog\/website-development\/c\/multiplication-of-objects-array-based-objects-object-multiply-by-object\/\",\"name\":\"Multiplication of objects, array based objects, object multiply by object\",\"isPartOf\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/#website\"},\"datePublished\":\"2012-02-29T13:47:01+00:00\",\"dateModified\":\"2014-03-19T09:14:04+00:00\",\"author\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7\"},\"description\":\"Multiplication of objects, array based objects, object multiply by object\",\"breadcrumb\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/c\/multiplication-of-objects-array-based-objects-object-multiply-by-object\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/androidbubble.com\/blog\/website-development\/c\/multiplication-of-objects-array-based-objects-object-multiply-by-object\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/c\/multiplication-of-objects-array-based-objects-object-multiply-by-object\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/androidbubble.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Website Development\",\"item\":\"https:\/\/androidbubble.com\/blog\/category\/website-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"C++\",\"item\":\"https:\/\/androidbubble.com\/blog\/category\/website-development\/c\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Multiplication of objects, array based objects, object multiply by object\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/androidbubble.com\/blog\/#website\",\"url\":\"https:\/\/androidbubble.com\/blog\/\",\"name\":\"AndroidBubble Blog\",\"description\":\"Articles &amp; Posts\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/androidbubble.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7\",\"name\":\"Fahad\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/afab5bcad71955d142a69df1758e6710aed4ab9cc2b5da28c54a7c3f39801b73?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/afab5bcad71955d142a69df1758e6710aed4ab9cc2b5da28c54a7c3f39801b73?s=96&d=mm&r=g\",\"caption\":\"Fahad\"},\"sameAs\":[\"http:\/\/www.androidbubbles.com\/\",\"https:\/\/x.com\/phpFlex\"],\"url\":\"https:\/\/androidbubble.com\/blog\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Multiplication of objects, array based objects, object multiply by object","description":"Multiplication of objects, array based objects, object multiply by object","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:\/\/androidbubble.com\/blog\/website-development\/c\/multiplication-of-objects-array-based-objects-object-multiply-by-object\/","og_locale":"en_US","og_type":"article","og_title":"Multiplication of objects, array based objects, object multiply by object","og_description":"Multiplication of objects, array based objects, object multiply by object","og_url":"https:\/\/androidbubble.com\/blog\/website-development\/c\/multiplication-of-objects-array-based-objects-object-multiply-by-object\/","og_site_name":"AndroidBubble Blog","article_publisher":"https:\/\/www.facebook.com\/pages\/Website-Design-Website-Development\/172363336135453","article_published_time":"2012-02-29T13:47:01+00:00","article_modified_time":"2014-03-19T09:14:04+00:00","author":"Fahad","twitter_misc":{"Written by":"Fahad","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/androidbubble.com\/blog\/website-development\/c\/multiplication-of-objects-array-based-objects-object-multiply-by-object\/#article","isPartOf":{"@id":"https:\/\/androidbubble.com\/blog\/website-development\/c\/multiplication-of-objects-array-based-objects-object-multiply-by-object\/"},"author":{"name":"Fahad","@id":"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7"},"headline":"Multiplication of objects, array based objects, object multiply by object","datePublished":"2012-02-29T13:47:01+00:00","dateModified":"2014-03-19T09:14:04+00:00","mainEntityOfPage":{"@id":"https:\/\/androidbubble.com\/blog\/website-development\/c\/multiplication-of-objects-array-based-objects-object-multiply-by-object\/"},"wordCount":316,"articleSection":["C++"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/androidbubble.com\/blog\/website-development\/c\/multiplication-of-objects-array-based-objects-object-multiply-by-object\/","url":"https:\/\/androidbubble.com\/blog\/website-development\/c\/multiplication-of-objects-array-based-objects-object-multiply-by-object\/","name":"Multiplication of objects, array based objects, object multiply by object","isPartOf":{"@id":"https:\/\/androidbubble.com\/blog\/#website"},"datePublished":"2012-02-29T13:47:01+00:00","dateModified":"2014-03-19T09:14:04+00:00","author":{"@id":"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7"},"description":"Multiplication of objects, array based objects, object multiply by object","breadcrumb":{"@id":"https:\/\/androidbubble.com\/blog\/website-development\/c\/multiplication-of-objects-array-based-objects-object-multiply-by-object\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/androidbubble.com\/blog\/website-development\/c\/multiplication-of-objects-array-based-objects-object-multiply-by-object\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/androidbubble.com\/blog\/website-development\/c\/multiplication-of-objects-array-based-objects-object-multiply-by-object\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/androidbubble.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Website Development","item":"https:\/\/androidbubble.com\/blog\/category\/website-development\/"},{"@type":"ListItem","position":3,"name":"C++","item":"https:\/\/androidbubble.com\/blog\/category\/website-development\/c\/"},{"@type":"ListItem","position":4,"name":"Multiplication of objects, array based objects, object multiply by object"}]},{"@type":"WebSite","@id":"https:\/\/androidbubble.com\/blog\/#website","url":"https:\/\/androidbubble.com\/blog\/","name":"AndroidBubble Blog","description":"Articles &amp; Posts","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/androidbubble.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7","name":"Fahad","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/afab5bcad71955d142a69df1758e6710aed4ab9cc2b5da28c54a7c3f39801b73?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/afab5bcad71955d142a69df1758e6710aed4ab9cc2b5da28c54a7c3f39801b73?s=96&d=mm&r=g","caption":"Fahad"},"sameAs":["http:\/\/www.androidbubbles.com\/","https:\/\/x.com\/phpFlex"],"url":"https:\/\/androidbubble.com\/blog\/author\/admin\/"}]}},"views":844,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/posts\/563","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/comments?post=563"}],"version-history":[{"count":2,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/posts\/563\/revisions"}],"predecessor-version":[{"id":1674,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/posts\/563\/revisions\/1674"}],"wp:attachment":[{"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/media?parent=563"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/categories?post=563"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/tags?post=563"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}