Wednesday, October 1, 2014

WAP to implement the concept of user defined copy constructor.

#include
#include
class test
{
            int a;
            public:
            test(int x)
   {
            a=x;
            }
            test(test &t)
   {
   a=t.a;
   }
            void display()
   {
             cout<<"a="<
            }

};

main()
{
            test t1(25);
            test t2(t1);
            cout<<"Contents of t1"<
            t1.display();
   cout<<"Contents of t2"<
            t2.display();
            getch();
}


No comments:

Post a Comment