Results 1 to 9 of 9

Thread: overloading true and false operators?

Hybrid View

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    overloading true and false operators?

    uuh what the heck would that mean? if a class overloads true and false, what does it really mean? how would you use those operators for that class then?

    (I'm an idiot as far as operator overloading is concerned, so please bear with me)
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  2. #2
    Fanatic Member
    Join Date
    Jan 2005
    Location
    Cebu
    Posts
    607

    Re: overloading true and false operators?

    Don't know really if we can overload it, provided that they have the same type (of type bool). Just go for a condition.
    VB Code:
    1. class test
    2. {
    3.     bool boolean;
    4.     public test(bool boolean)
    5.     {
    6.         if(boolean) true_statement();
    7.         else false_statement();
    8.     }
    9.     void true_statement(){}
    10.     void false_statement(){}
    11. }

  3. #3

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Re: overloading true and false operators?

    this is what I meant

    public static bool operator true (myClass val)
    {
    return true;
    }
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  4. #4
    Fanatic Member
    Join Date
    Jan 2005
    Location
    Cebu
    Posts
    607

    Re: overloading true and false operators?

    Oppss.

    Yes, you're right. Can't seem to find a good example why true/false operator is overloaded.

  5. #5
    Fanatic Member
    Join Date
    Jan 2005
    Location
    Cebu
    Posts
    607

    Re: overloading true and false operators?

    Just found this. Don't really understand it coz I don't really understand English well. But hopes this might have a use for you.

  6. #6

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Re: overloading true and false operators?

    hmmmmmmmmmmmmmm
    thanks, but I still dont understand it
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width