C++ data conversion of user defined object
<p>In this program we use data conversion from class a to class c.when we use</p>

<pre><code>a(c c1)
{
   return (c1.getd()*100)
}
// constructor in class a, this is correct, but when when we use

c(a a1)
{
   return (a1.getb()/100)
}
// constructor, then compile error comming that getb is not a member of a please clear what is the problem.


#include&lt;iostream.h&gt;
#include&lt;conio.h&gt;

    class a;
    class c {
       int d;
       public:
          c() {
             d=0;
          }
          c(int x) {
             d=x;
          }
          int getd() {
             return d;
          }
          void putdata() {
             cout&lt;&lt;d;
          }
          c(a a1){ 
             d=(a1.getb()/100);//here is compile error coming --getb is not a member of a
          }
  };
  class a {   
     int b;
     public:
       a() {
     b=0;
       }
       a(int x) {
     b=x;
       }
       void putdata() {
         cout&lt;&lt;b;
       }
       int getb() {
         return b;
       } 
   };

  void main() {
    c c1;
    a a1=100;
    a a2(100);
    c1=a1;

    c1.putdata();
    getch();
  }
</code></pre>
