Program to illustrates Nesting of Member Functions


#include<iostream.h>
#include<conio.h>
class set
{
    int m, n;
    public:
    void input(void);
    void display(void);
    int largest(void);
};
int set :: largest (void)
{
    if (m>=n)
         return(m);
    else
          return(n);
}
void set :: input (void)
{
    cout<<"Input values of m and n  : ";
    cin>>m>>n;
}
void set :: display (void)
{
    cout<<" Largest value = "
    <<largest( ) <<"\n";                 // calling member function
}
void main( )
{
    set A;
    A.input( );
    A.display( );
    getch( );
}

3 comments:

Simply said...

i hav done the same program as shown above but still i m getting errors

Simply said...

set::largest is not a member of 'set'.
set:: largest cannot return a value.
these r the errors whch i m getting

Simply said...

pls reply me soon its very muchh needed for me as my exams are on my head

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|