Thread: Operator that returns no value but returns value

  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    81

    Operator that returns no value but returns value

    I forget what that damned operator is called that returns no value except it does return a value...

    It is used so you can do assignment with your class being an r_value ( the assignment operator isn't a member of your class )

    Does anyone know what i'm talking about? I just need the name of it so i can google it.
    Last edited by keira; 01-19-2008 at 12:58 PM.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,412
    That sounds like a contradiction. As a wild guess, are you talking about conversion functions such as operator int() and operator bool()?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Something that returns something yet it does not? Can that be void?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    A conversion operator doesn't need to have a return type specified because the return type will always be the type of the operator. However, it does return a value, so I'm guessing laserlight is correct.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Lame null append cause buffer to crash
    By cmoo in forum C Programming
    Replies: 8
    Last Post: 12-29-2008, 03:27 AM
  2. Polynomials and ADT's
    By Emeighty in forum C++ Programming
    Replies: 20
    Last Post: 08-19-2008, 08:32 AM
  3. Function returns null value instead of zero
    By drdepoy in forum C Programming
    Replies: 3
    Last Post: 10-23-2005, 03:51 PM
  4. Replies: 2
    Last Post: 04-12-2004, 01:37 AM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM