0

I am beginning to programming. I am stuck in this point so I hope you guys will help me.

When we write a post decrement member function the syntax for that is

     type type::operator--(int){}

But I want this to be a friend function so how can i write it?

This is for pre increment:

   friend Mystring &operator--(  Mystring &lhs);

What is the syntax for post incrementation?

Kalamarico
  • 5,466
  • 22
  • 53
  • 70
Hamza
  • 82
  • 9

1 Answers1

0

Try like this:

class type
{
// ...
    // postfix operator--
    friend type operator--(type &t, int){type t1; /* some logics */ return t1;}
};
snake_style
  • 1,139
  • 7
  • 16