by Dinesh Thakur Category: Classes in C++


#include <iostream.h>

class Height
                 int feet;
                 float inches;
                 Height() :feet(0), inches( 0.0) {}
                 Height(int ft,float in):feet(ft),inches(in){}
                 void get()
                     cout <<"\n Feet";
                     cin >>feet;
                     cout <<" inches:";
                     cin >>inches;
                void show()
                     cout <<feet <<" - " <<inches;
          void main()
              Height H1(6,4.0);
              Height H2(H1);
              Height H3 =H1;
              cout <<"\nHeigh1 =";;
              cout <<"\nHeigh2 =";;
              cout <<"\nHeigh3 =";;
              cout <<endl;

Default Copy Constructor

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.

Related Articles