#include #include #include struct derived_actor { inline actor; // Plan-9 C nominal inheritance }; void ?{}( derived_actor & this ) { // Default constructor definition ((actor &)this){}; // Call to actor constructor } struct derived_msg { inline message; // Plan-9 C nominal inheritance char word[12]; }; void ?{}( derived_msg & this, char * new_word ) { // Overload constructor definition ((message &) this){ Finished }; // Call to message constructor passing allocation status strcpy(this.word, new_word); } Allocation receive( derived_actor & receiver, derived_msg & msg ) { printf("The message contained the string: %s\n", msg.word); return Finished; // Return allocation status of Finished now that the actor is done work } int main() { start_actor_system(); // Sets up executor. Actors and messages can be created after this point. derived_actor my_actor; derived_msg my_msg{ "Hello World" }; // Constructor call my_actor | my_msg; // All message sends are done through the bar operator stop_actor_system(); // Waits until all actors are finished return 0; }