Thread: Calling a function with same name but different return type!!!

  1. #16
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by CommonTater
    Yes, main() can also be declared void... but you do so at the risk of causing errors in the OS or Parent program.
    poornaMoksha, you might also encounter a similiar problem for your own example, since if func was expected to return particular values on success or failure, then a programmer that uses your func function may be misled by the result.
    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

  2. #17
    Registered User poornaMoksha's Avatar
    Join Date
    Sep 2011
    Location
    India
    Posts
    41
    Quote Originally Posted by laserlight View Post
    poornaMoksha, you might also encounter a similiar problem for your own example, since if func was expected to return particular values on success or failure, then a programmer that uses your func function may be misled by the result.
    Yup I know this as I was trying to replicate the same scenario. Anyways thanks for your valuable contribution.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to properly return MySQL results to a calling function?
    By Effenberg0x0 in forum C Programming
    Replies: 3
    Last Post: 06-09-2011, 03:42 AM
  2. Replies: 2
    Last Post: 11-03-2010, 07:00 AM
  3. Function return type
    By nedim in forum C++ Programming
    Replies: 2
    Last Post: 09-27-2009, 12:58 PM
  4. function with no return type
    By abhi_86 in forum C Programming
    Replies: 12
    Last Post: 11-25-2006, 11:48 AM
  5. Replies: 6
    Last Post: 04-09-2006, 04:32 PM