Re: object-oriented C programming
Philip Brown wrote:
>
> Since you are apparently still in college, I leave "how to implement
> inheritance" as an excercise to the reader :-)
>
It's been some time since I've graduated. Anyway, the example you give
has no meaning wrt object-oriented programming. Since you claimed
that it was object-oriented programming, I thought you needed to
learn a little bit more.
On the other hand, anyone who has taken an OOP course could tell
you the difference between object-oriented and object-based programming.
Inheritance is a necessary requirement for the former "paradigm" or
whatevery you wanna call it. It looks to me that you've either slept
through your OO classes, or haven't studied any. [*]
> It IS doable. It's just not as pretty as a language with direct inheritance
> support.
>
Really? I wonder if you've ever done that for yourself. Did you look
at GTK+ as I suggested... :/
The petty and incompetent example you give does not seem to allow for
full object-orientation.
> If YOU dont want to use this methodology, fine. Just keep quiet, and let
> others who DO want to use it, discuss it.
>
Ah, now I see what you mean.
You are a _lamer_. The only PL you've used is C, and you think that
your example represents a _methodology_.
What you've given as example is good old C code, nothing more.
Here's part of publib, probably hacked a bit...
This isn't object-oriented, mildly object-based but still lacking
a lot of flavor. And this is the style with which many C coders
write.
#ifndef __publib_stack_h
#define __publib_stack_h
#include "global.h"
struct __stack {
void **data;
size_t *size;
size_t allocated, used;
};
typedef struct __stack Stack;
Stack *stack_create(void);
void stack_destroy(Stack *);
void stack_pop(Stack *, void *);
int stack_is_empty(Stack *);
Stack *stack_copy(Stack *);
int stack_push(Stack *, void *__data, size_t __bytes);
void stack_pop_plain(Stack *st);
int stack_size(Stack *st);
void stack_append(Stack *st, Stack *st2);
void stack_empty(Stack *st);
void stack_move(Stack *st, Stack *st2, int);
#endif
what is your point here?
Either,
* you have developed some kind of phobia against languages with
class constructs
* you want to rant about something you don't know that well
* you're in bed with Linus.
Or you're in some exotic mind state which I cannot estimate. What're
you using?
!!
[*] Reading any of the recent OOD/OOP books would do.
--
Eray (exa) Ozkural
Comp. Sci. Dept., Bilkent University, Ankara
e-mail: erayo@cs.bilkent.edu.tr
www: http://www.cs.bilkent.edu.tr/~erayo
Reply to: