On Wed, Dec 01, 2010 at 03:49:40AM -0500, Chris Wolf scratched on the wall:

> It depends on your definition of "object".  I hate to nit-pick, but for
> me, "object" may contain data or code or both data and code.  So with
> this definition, C implements objects without code.

  C++ classes don't "contain" code any more than structs do.  The
  language has syntax that allows the method declarations (but not
  definitions) to be linked, but it isn't like a class instance has
  compiled code inside of it.  The function definitions aren't even
  within the class definition... class methods are defined as
  stand-alone top-level functions with the linker taking care of all
  the details.

  Besides, it is easy enough to put function pointers into a struct.
  Plenty of us were doing that for years, long before C++ started to
  gain ground.  This is more or less how virtual methods are
  implemented anyways.  Yes, you have to initialize the pointers
  manually, but the same is true of the data values in a struct-- or
  classes for that matter.  The only difference is that you have to
  remember to manually call your init function in C.

  Using function pointers also allows redefinition of methods on the
  fly without re-instancing an object, essentially giving the ability
  to morph an object from one class type to another type in-place.
  It is unfortunate that the C/C++ function pointer syntax is so odd.
  It scares a lot of people away from a very powerful tool that can be
  used for all kinds of generic programming.



  It's also worth pointing out that, while objects are core to the C++
  language, I don't think anyone with wide experience in high-level object
  oriented languages would consider C++ to be a particularly
  representational OO language.  If C++ is your primary exposure to an
  OO language, you are likely to have a somewhat twisted view of what
  OO is all about.  
  
  In many ways, C++ is to OO as SQL is to the Relational Model.  Close,
  but not quite, in so many small but important ways.


  [And with that reference, this post has something to do with databases!]

   -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable." -- Angela Johnson
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to