friend function

May 1, 2015 at 2:17am
how to make this:

---- 1 0 1
2 x 1 1 1
---- 1 0 1

or this:

1 0 1
1 1 1 x 2
1 0 1

note: this two types must be work in main, ignore the ----
Last edited on May 1, 2015 at 2:39am
May 1, 2015 at 2:36am
i can make the second types but the first types i can't
May 1, 2015 at 6:36am
You will need two version of the operator, one for each order as you have shown above. If you have the operator as a member function the first operand is always the class object. To be able to have a different type as first operand you will have to define the operator outside the class.
May 1, 2015 at 11:26am
can you share me the code?
May 1, 2015 at 11:47am
No, I have not written any code.
May 1, 2015 at 1:16pm
can you make it? then share it to me
May 1, 2015 at 1:22pm
If this is your homework, aren't you supposed to do it?
May 2, 2015 at 3:15am
i have make it, but it stuck, so i should know how the truth
Topic archived. No new replies allowed.