Pointer to an overloaded operator...

This is a discussion on Pointer to an overloaded operator... within the C++ Programming forums, part of the General Programming Boards category; I'm not sure how to put this into words... so how would you go about doing this: Code: struct TEST; ...

  1. #1
    Not stupid, just stupider yaya's Avatar
    Join Date
    May 2007
    Location
    Earthland
    Posts
    204

    Thumbs up Pointer to an overloaded operator...

    I'm not sure how to put this into words... so how would you go about doing this:

    Code:
    struct TEST;
    {
    	operator+ ( int ) { /* ... */ };
    	/* More members here*/
    };
    
    int main()
    {
    	TEST* test = new TEST;
    	test->+ 12; // NEED HELP HERE!!
    }
    Thanks!

  2. #2
    Registered User
    Join Date
    Apr 2006
    Posts
    2,053
    You mean this:
    Code:
    *test + 12;
    It is too clear and so it is hard to see.
    A dunce once searched for fire with a lighted lantern.
    Had he known what fire was,
    He could have cooked his rice much sooner.

  3. #3
    Not stupid, just stupider yaya's Avatar
    Join Date
    May 2007
    Location
    Earthland
    Posts
    204
    Haha, I should've known that... I guess I was going brain-dead there for a second. Anyways, thanks a bunch!

  4. #4
    The larch
    Join Date
    May 2006
    Posts
    3,573
    Also, function call syntax is possible

    Code:
    test->operator+( 12 );
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to do encryption in C
    By sankarv in forum C Programming
    Replies: 33
    Last Post: 12-28-2010, 11:01 AM
  2. Replies: 3
    Last Post: 12-09-2008, 11:19 AM
  3. Following CTools
    By EstateMatt in forum C Programming
    Replies: 5
    Last Post: 06-26-2008, 11:10 AM
  4. overloaded >> operator issue...
    By soulredemption in forum C++ Programming
    Replies: 2
    Last Post: 10-17-2005, 11:53 PM
  5. operator overloading and dynamic memory program
    By jlmac2001 in forum C++ Programming
    Replies: 3
    Last Post: 04-07-2003, 12:51 AM

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