hello every one i am new member of this community.
Any one see my problem please reply.
problem :- How to use object as Function argument.
please reply.....

Recommended Answers

All 2 Replies

use it just like you would any POD (Plain Old Data). Your question is so vague that all I can give you is a vague response.

Some thing of this sort if your function is a part of the class definition

class complex
{
      int x;
      int y;

public :
       complex(int x, int y)
       {
                this->x=x;
                this->y=y;
       }
       
       void display(complex c)
       {
            cout<<c.x<<" "<<c.y<<endl;
       }
};

int main()
{
    complex c1(10,5);     
    c1.display(c1);   
         
    cin.get();
    return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.