c++ - Is using *this a good idea? -


I'm not sure

  return * this  

Is there a way we can return an example of a member who calls the party's function? I said that the reason is that our instructor told us to avoid using pointers if necessary and I am thinking that this is a case where this indicator is returning the only way to do it.

I am working with a fractional class which keeps personal data member portions and divisor. For example, I'm talking about member function, for example, to add two degrees:

  fraction C = apples (b);  

Plus member function is defined as:

  fraction & amp; Plus (const fracture fract)  

The instructor wants us to C = A + = B, so I think this is the reason.

Get a new trainer It seems that the plus () announcement is completely false

  • Should return a price instead of context reference
  • If it has to return a reference, then it should return a reference reference
  • Should take a const reference as a parameter
  • This member can be more likely to have a smarter sense of function The Anwyn Of course, it should probably be a friend.


    Comments

    Popular posts from this blog

    c++ - Linux and clipboard -

    What is expire header and how to achive them in ASP.NET and PHP? -

    sql server - How can I determine which of my SQL 2005 statistics are unused? -