title: C++ is not Giving Expected output
body: <p>I'm Student of I.T In our Text Book there are so many programs of Simple inheritance but those are very long practicals so its very Difficult to understand and very difficult to remember so I tried to make a small simple inheritance program in C++ but The program is not giving the expected output.</p>
  
  <p>I've Used C++ for windows 7 </p>
  
  <p>Here is the code :</p>
  
  <pre><code>#include"iostream.h" 
  #include"conio.h"
  
  class A
  {
  public:
  int a,b;
  
  void setData(int i,int j)
  {
     a=i;
     b=j;
  
  }
  
  };
  class B: public A
  {
     public:
     int compare()
     {
    return(a&gt;b?a:b);
     }
  
  };
  
  
  void main()
  {
  A a;
  B b;
  //int c;
  clrscr();
  
  a.setData(25,9);
  
  
  cout&lt;&lt;"answer: "&lt;&lt;b.compare();
  
  getch();
  
  }
  </code></pre>
  
  <p>Output is like this </p>
  
  <pre><code>answer : 1213
  </code></pre>
  
  <p>So plz help me N tell me Why the Output is like this !!!! 
  I just want to learn </p>