Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualKarsten_

Posted 14 November 2013 - 06:51 PM

struct DeadPlayer {
     Player player;
     Point deathLocation;
}

Now, you write methods that take a DeadPlayer* as their first argument (and observe, you can pass DeadPlayer pointers to all methods that expect a Player).


Nice example.
Usually a fairly junior C# or Java developer will jeer at C because they don't realize or understand how this works. This is how Gtk+ (and many object-orientated C libraries) does it and demonstrates that C is pretty darn flexible.

#1Karsten_

Posted 14 November 2013 - 06:47 PM

struct DeadPlayer {
     Player player;
     Point deathLocation;
}

Now, you write methods that take a DeadPlayer* as their first argument (and observe, you can pass DeadPlayer pointers to all methods that expect a Player).


Nice example.
Usually a C# or Java developer will jeer at C because they don't realize or understand how this works.

PARTNERS