Sealed classes and methods: Difference between revisions
Content added Content deleted
(→{{header|C}}: Spoke too soon, just figured out an easy way to do this.) |
(→{{header|C}}: Simplified code a bit.) |
||
Line 47: | Line 47: | ||
void watchMovie(parent *p, typeid id) { |
void watchMovie(parent *p, typeid id) { |
||
if (id == |
if (id == CHILD && p->age < 15) { |
||
⚫ | |||
⚫ | |||
printf("%s is watching the movie...\n", p->name); |
printf("%s is watching the movie...\n", p->name); |
||
} else if (id == CHILD) { |
|||
if (p->age < 15) { |
|||
⚫ | |||
⚫ | |||
printf("%s is watching the movie...\n", p->name); |
|||
} |
|||
} |
} |
||
} |
} |
||
int main() { |
int main() { |
||
parent p = { "Donald", 42 }; |
parent p = { "Donald", 42 }; |