• Programmer Belch@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    1
    ·
    4 hours ago

    I didn’t need to do this but I did and now I want it in my comment history:

    class Suckable {
        bool unsucked;
    
    public:
        Suckable () {
            unsucked = true;
        }
    
        void Suck() {
            unsucked = false;
        }
    
        void CheckAndSuck() {
            if (unsucked) {
                Suck();
            }
        }
    };
    

    Sorry for making you see c++, it’s the language I’m currently using. This program compiles on my machine and doesn’t use global variables.