-6

I have this code (just a snippet)

const Line & operator= (rhs : const Line &)
{
}

But I am getting:

Unknown type name 'rhs'

What should I do?

Rakete1111
  • 47,013
  • 16
  • 123
  • 162
Wang Eric
  • 13
  • 2

1 Answers1

2

You need to write

Line& operator=(const Line& rhs)

Note the placement of rhs.

I've also dropped the const at the beginning of the line since the conventional thing to return when overriding assignment is a reference to self, not a const reference to self.

Bathsheba
  • 231,907
  • 34
  • 361
  • 483