Thread: rhs?

  1. #1

    Question rhs?

    In my C++ book (Sams TYC++ in 21 days) when discussing classes it uses rhs in the member functions (what ever you wish to call them). Here is an example of what I getting this from-

    Counter Counter::Add(const Counter & rhs)
         return Counter(itsVal+ rhs.GetItsVal());
    There is no variable named rhs... What is rhs? Is it just an alias or something?

  2. #2
    I lurk
    Join Date
    Aug 2002
    rhs is a variable(reference) passed to the function.
    rhs means 'right hand side', it's a common name for variables which don't really have any other meaningful name.

  3. #3
    Registered User
    Join Date
    Nov 2002
    rhs is local to the function. it is the parameter passed to the function, but the Add function knows this variable as being rhs. as for what it stands for, not really sure. I've seen it used with overloaded assignment operators, and guessed it to mean 'right hand side' in that case.

    edit: I guess it does mean 'right hand side'

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Base class undefined
    By BKurosawa in forum C++ Programming
    Replies: 8
    Last Post: 08-08-2007, 03:37 PM
  2. Inheritance
    By BKurosawa in forum C++ Programming
    Replies: 19
    Last Post: 08-07-2007, 08:34 PM
  3. += operator
    By BKurosawa in forum C++ Programming
    Replies: 8
    Last Post: 08-05-2007, 03:58 AM
  4. can't understand error message.
    By nurulhafiz in forum C Programming
    Replies: 18
    Last Post: 09-13-2006, 09:25 PM
  5. complex number arithmetic
    By Micko in forum C++ Programming
    Replies: 1
    Last Post: 12-10-2003, 09:04 AM