-
-
Save erikroyall/1447aa83e9b65a81f664521781423eed to your computer and use it in GitHub Desktop.
Objectification Oriented Programming
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#define YEP 1 | |
#define NOPE 0 | |
struct woman { | |
int makesSandwiches: 1, ironsClothes: 1, earnsMoney: 1; | |
}; | |
struct man { | |
int cooks: 1, earnsMoney: 1, worksOut: 1; | |
}; | |
_Bool isWomanNormal(struct woman dudette); | |
_Bool isManNormal(struct man *dude); | |
int main(void) { | |
struct woman pootina = {0, 0, 1}; | |
struct man pooter = {0, 0, 1}; | |
printf("Pootina is %s\n", (isWomanNormal(pootina) == 1) ? "normal" : "not normal"); | |
printf("Pooter is %s\n", (isManNormal(&pooter) == 1) ? "normal" : "not normal"); | |
return EXIT_SUCCESS; | |
} | |
_Bool isWomanNormal(struct woman dudette) { | |
if ((dudette.makesSandwiches == 0) || (dudette.ironsClothes == 0) || (dudette.earnsMoney == 1)) { | |
return NOPE; | |
} | |
return YEP; | |
} | |
_Bool isManNormal(struct man *dude) { | |
if ((dude->cooks == 1) || (dude->earnsMoney == 0) || (dude->worksOut == 0)) { | |
return NOPE; | |
} | |
return YEP; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment