Unable to load image

C++ coding tutorial :marseyscratch:

feminism_idle.h:

#include <men>


 // Namespace is used to separate functions from the outside; you can use namespace::member to access a member of the namespace
namespace feminist {


    // The function doesn't return anything, thus void
    void idle() {
        for (auto man : men::population) {
            man.hate();
            if (feminist::ready) {
                feminist::pronouns = "xir/xer";
                man.kill();
            }
        }
    }
}
14
Jump in the discussion.

No email address required.

having trouble deciphering this, little drunk and it's been like 8 years since I've worked with C

new namespace, function idle with no return or arguments. for each item in population in men we name man and work on and run the hate function

the feminist ready tho is confusing, I thought that was an attribute of a instantiated object but you never initialized anything. oh i guess it could be static but wouldn't that always return true or false? I guess it could be a concurrent thread thing

Jump in the discussion.

No email address required.

If I remember correctly namespaces can be spread over multiple files, so you could have another file 'feminism_ready.h' with the content

namespace feminist{
    bool ready = false;
}

I may be wrong though

Jump in the discussion.

No email address required.

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.