Thread: Pointer to an overloaded operator...

  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,149
    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, 10:10 AM
  4. overloaded >> operator issue...
    By soulredemption in forum C++ Programming
    Replies: 2
    Last Post: 10-17-2005, 10:53 PM
  5. operator overloading and dynamic memory program
    By jlmac2001 in forum C++ Programming
    Replies: 3
    Last Post: 04-06-2003, 11:51 PM