[sdiy] IN your mind, what is ....

ChristianH chris at scp.de
Tue Feb 3 16:58:56 CET 2004


Oops, now I know where that open mail compose window went...

I was about to write that in object oriented design, the function is
more closely tied to the struct aka object. Low level functions can even
be shielded from the outside world, so they can _only_ be used from
functions belonging to the same class. This needs some time to get
acustomed to, but in the end it can lead to much cleaner program
structures.

Although it usually needs a certain project size before this concept
really pays off. And it takes some time before you really start to think
in classes. 
Furthermore, I wouldn't agree with another post from this multi-functional
thread, where someone suggested to ignore inheritance - once you started
to encapsulate things as classes, it's almost mandatory to work with
derived classes. And be it only to specify a common denominator how a
certain interface should look like in general, and then implement each
particular occurence of this interface for specific cases (classes).
If e.g. the Windows API had been designed with that in mind, it wouldn't
have become such a mess where similar things are done in an inconsistent
manner.

Christian



On Tue,  3 Feb 2004 16:27:38 +0100 (CET) ChristianH wrote:

> not quite, in this case the struct references a function, it does not
> contain it. The point is that in 
> 
> Christian
> 
> 
> 
> On Tue, 3 Feb 2004 11:23:21 +0100 (CET) Rainer Buchty wrote:
> 
> > > Want an explanation that makes C++ sound good?
> > >
> > > "C structs that can contain functions".
> > 
> > Uhm... C structs can contain functions, even without ++. How about
> > something like this:
> > 
> > typedef struct mc68cmd_s
> > {
> >         char *mask;
> >         char *mnem;
> >         char *para;
> >         int (*callback)(dispc_t *pc, mc68cmd_s *cmd, int datas[], char *str);
> >         int flags;
> > } mc68cmd_t;
> > 
> > People just dislike pointers nowadays :)
> > 
> > Rainer



More information about the Synth-diy mailing list