latest Post

C + + part-10 ( operator overloading - without use of friend function )







So hey guys it's been a long time that i publish a article , so here is you hack guru comes with a new article in this series and if you don't see he other ones than i give link below visit it and see all of them.

                                   !!!!ALL THE ARTICLES LINK ARE HERE!!!!

In this article we are going to know about that how can we overload a operator without the help of the friend function which we does in the last article of this series .
So let's go..................................................................................................................................................

........................................................................CODE...............................................................................




#include<iostream.h>
#include<conio.h>

class abc
{
              int i ;
              public :
                        void input ( )
                        {
                                                 cout<<"enter any number : ";
                                                 cin>>i ;
                        }
                        int display ( )
                        {
                                                 return i ; 
                        }
                        abc ( operator +( abc m ) )
                        {
                                                 abc temp ;
                                                 temp.i = i + i.m ;
                                                 return temp ;
                        }
} ;
void main ( )
{
                    abc a,b,c ;
                    a.input ( ) ;
                    b.input ( ) ;
                    c = a+b ;
                    getch ( ) ; 
}





ANY ISSUES WITH ANY ARTICLE YOU CAN WRITE IN THE COMMENT BOX AND FEEL RELAXED AND WAIT FOR THE ANSWER .
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!THANKS FOR YOUR TIME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
STAY TUNED FOR MORE SUCH ARTICLES ON THIS BLOG .
<<<<<<<<<<<<<<<<<<<<<<<<<<HAVE A NICE DAY>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>



About hack guru

hack guru
Recommended Posts × +

0 comments:

Post a Comment