[linux-elitists] Nobody's favorite language? C++ and free software

Nick Moffitt nick@zork.net
Wed Mar 26 15:13:26 PST 2003


begin  Martin Pool  quotation:
> Inherited classes could be added to C without major damage; you can
> already do it with macro trickery.

	I always did it with nested structs.  The first element of a
struct is an instance of the parent struct, so you can always cast the
thing and treat it like the parent.  You need to be careful with
memory management, but throwing big structs around on the stack is bad
news most of the time anyway.

	Add in function pointers and use self parameters and you've
got most of the functionality that basic OOP provides.

	I'm not a big fan of the goofy parallel structures that glib
uses to get classes vs structs.  

-- 

end



More information about the linux-elitists mailing list