Have you ever see this function:..

This is a discussion on Have you ever see this function:.. within the C++ Programming forums, part of the General Programming Boards category; Code: int num; string str1, str2; num = str1.str2("*") +1; ok what does this mean............ and why they use it?... ...

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    249

    Have you ever see this function:..

    Code:
    int num;
    
    string str1, str2;
    
    num = str1.str2("*") +1;
    ok what does this mean............
    and why they use it?... and how can I use it?
    C++
    The best

  2. #2
    Registered User -Xp-'s Avatar
    Join Date
    Nov 2002
    Posts
    28
    dont functions usually have () after their name and

    {
    some of these
    }
    No I DIDN'T steal my name from Misro$ofts OS, it's pure coincidence.

    The lines around my name (-) are only there because i needed a name over the 3 character minimum letter limit

  3. #3
    Registered User
    Join Date
    Jun 2002
    Posts
    82
    Hell if I know. It won't even compile on my system. How do you know that its a function? Wherever you got that information should tell you how its used. You ask how they use it...who's "they"? For that matter, which function are you talking about? I don't see any; you're trying to call str2 like its a member function of str1, when you actually declared it as a string variable in its own right. Where did you get your code fragment and did you test it to see that it actually did anything?

    These are good questions to have answered already when you post a vague question.
    Claus Hetzer
    Compiler: Borland 5.5 (on Windows)
    Solaris CC (on Unix)
    Known Languages: C++, MATLAB, Perl, Java

  4. #4
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    Assuming this is C++, and you (or sombody) forgot the brackets, and that it works... The function and class have to be defined somewhere else in to code. Maybe in another "included" file.

    I don't recognize this as anything from the standard library, but I'm not absolutely sure.

    It does seem unusual to have a variable and an object both named str1, and a variable and a function both named str2. Is this legal overloading... I dunno? I think there's something wrong with passing "*" to a function too! (?)

    ... Doesn't look like C++ to me!

  5. #5
    Registered User
    Join Date
    Apr 2002
    Posts
    249

    this is my question again........

    I was reading the code for a file, and it has these lines

    as str1 and str2 strings
    and num is an integer number

    my question was :
    " HAVE YOU HEAR ABOUT ANYTHING LIKE1"

    num = str1.str2("*");

    the problem that the cpp file does compiled.
    and I don't understand what does this means , and even I didn't know why the programmer ( they) use it , and for what.

    NOTE: it is not over loaded function of "."

    and thanx for the replays.
    C++
    The best

  6. #6
    Registered User -Xp-'s Avatar
    Join Date
    Nov 2002
    Posts
    28
    i still dont think thats a function
    No I DIDN'T steal my name from Misro$ofts OS, it's pure coincidence.

    The lines around my name (-) are only there because i needed a name over the 3 character minimum letter limit

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 04:06 PM
  3. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 02:01 AM
  4. Replies: 28
    Last Post: 07-17-2006, 12:35 AM
  5. const at the end of a sub routine?
    By Kleid-0 in forum C++ Programming
    Replies: 14
    Last Post: 10-23-2005, 07:44 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21