<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>C&#43;&#43; on Saleem Ansari</title>
    <link>/tags/c&#43;&#43;/</link>
    <description>Recent content in C&#43;&#43; on Saleem Ansari</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <copyright>(c) 2024 Saleem Ansari</copyright>
    <lastBuildDate>Sat, 17 Jul 2010 00:00:00 +0000</lastBuildDate>
    <atom:link href="/tags/c++/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>C&#43;&#43; inheritance and function overloading</title>
      <link>/2010/07/17/c-inheritance-and-function-overloading/</link>
      <pubDate>Sat, 17 Jul 2010 00:00:00 +0000</pubDate>
      <guid>/2010/07/17/c-inheritance-and-function-overloading/</guid>
      <description>Here is a simple looking C++ program, which has two classes A and B ( which derives from A ). A has a function fun() which B tries to overload as fun(int). Sounds simple and the program looks correct but it doesn&amp;rsquo;t compile. Have a look at http://codepad.org/NQ3JNuRr .&#xA;Its hard to digest for it is an obvious code to compile in C++. The code listing is as below:&#xA;#include&amp;lt;iostream&amp;gt; using namespace std; class A{ public: void fun(){cout&amp;lt;&amp;lt;&amp;#34;fun\n&amp;#34;;} }; class B: public A{ void fun(int i){cout&amp;lt;&amp;lt;&amp;#34;funB\n&amp;#34;;} }; int main() { B b; b.</description>
    </item>
    <item>
      <title>C&#43;&#43; reference not to be confused with Java/Python/... reference</title>
      <link>/2010/05/24/c-reference-not-to-be-confused-with-java/python/...-reference/</link>
      <pubDate>Mon, 24 May 2010 00:00:00 +0000</pubDate>
      <guid>/2010/05/24/c-reference-not-to-be-confused-with-java/python/...-reference/</guid>
      <description>This program assigns a new object of class A to reference a. It looks as expected, reference changes to new object ( see line 23,24,25):&#xA;#include &amp;lt;iostream&amp;gt; using namespace std; class A { string name; public: A(string n): name(n) { } A(): name(&amp;#34;NO ONE&amp;#34;) { } void print() { cout &amp;lt;&amp;lt; &amp;#34;I am &amp;#34;&amp;lt;&amp;lt; name &amp;lt;&amp;lt; &amp;#34;!&amp;#34;&amp;lt;&amp;lt; endl; } }; int main(int argc, char *argv[]) { A matrix = A(&amp;#34;the matrix&amp;#34;); A &amp;amp;amp;a = matrix; a.</description>
    </item>
  </channel>
</rss>
