Re: Adding the ability to add functions into structures?
- From: "Chuck F. " <cbfalconer@xxxxxxxxx>
- Date: Sat, 31 Dec 2005 08:48:00 -0500
Richard Heathfield wrote:
Chuck F. said:Jack Klein wrote:... snip ...
I know I'll get flamed for this, but with the exception of inheritance this is really nothing but syntactical sugar.
You can write object oriented programs in C right now.
A perfect example is the FILE data type, declared an <stdio.h>. It has a creator, fopen(), a destructor, fclose(), and all sorts of methods you can invoke on it via its pointer, such as fprintf(), fscanf(), fread(), fwrite(), between its successful creation and its destruction.
I see no reason for any fires. The only problem with your example is that you can't write (in general) that type in C.
I must have misunderstood what you mean, because I see no reason whatsoever why one could not write (in general) that type in C.
I meant that to implement FILE you have to access such things as ports, disks, etc. that take you out of pure C.
-- "If you want to post a followup via groups.google.com, don't use the broken "Reply" link at the bottom of the article. Click on "show options" at the top of the article, then click on the "Reply" at the bottom of the article headers." - Keith Thompson More details at: <http://cfaj.freeshell.org/google/> .
- Follow-Ups:
- Re: Adding the ability to add functions into structures?
- From: Richard Heathfield
- Re: Adding the ability to add functions into structures?
- References:
- Adding the ability to add functions into structures?
- From: Albert
- Re: Adding the ability to add functions into structures?
- From: Jack Klein
- Re: Adding the ability to add functions into structures?
- From: Chuck F.
- Re: Adding the ability to add functions into structures?
- From: Richard Heathfield
- Adding the ability to add functions into structures?
- Prev by Date: Re: Structure size and binary format
- Next by Date: Re: What's the guideline for dealing with unwanted chars in input stream?
- Previous by thread: Re: Adding the ability to add functions into structures?
- Next by thread: Re: Adding the ability to add functions into structures?
- Index(es):
Relevant Pages
|