Live data from Hacker News

OOP in C

staff.washington.edu

1–10 of 149 posts

Re: OOP in C

#3

A whole book on this topic was already written in 1993 by Axel-Tobias Schreiner. It seems to be freely available nowadays: https://www.cs.rit.edu/~ats/books/ooc.pdf (edit: link updated to point to author's website)

I remember having a book on the shelf through the 90s entitled 'Object Oriented Programming in Macro Assembler'

Re: OOP in C

#8

A whole book on this topic was already written in 1993 by Axel-Tobias Schreiner. It seems to be freely available nowadays: https://www.cs.rit.edu/~ats/books/ooc.pdf (edit: link updated to point to author's website)

I remember having a book on the shelf through the 90s entitled 'Object Oriented Programming in Macro Assembler'

Maybe this https://www.semanticscholar.org/paper/An-object-oriented-ass... ?

Re: OOP in C

#9

[flagged]

Hi. For background, I have been writing professional OOP code in ANSI C.

Yes, Structures in C can be used as classes. And yes, this includes polymorphism.

My solution was to put a callback in the structure that would point to the implementation that was polymorphic. This allowed me to pass the struct around and then call the specific implementation at the right time.

When you write OOP in C you do not need to make it look like OOP language. You just need to understand what OOP is about and use the existing language to do what you need it to do as efficiently as possible.

As to spending time on writing functionality that is readily available in other languages... sometimes you just don't have a choice. There are programming environments where ANSI C is the only language available as was in my case.

Please, try not to be too dismissive to the things you do not understand.

Post reply on HN