Object-Oriented Programming in C (2019) [pdf]
state-machine.com
Object-Oriented Programming in C (2019) [pdf]
1–10 of 95 posts
Re: Object-Oriented Programming in C (2019) [pdf]
#2Re: Object-Oriented Programming in C (2019) [pdf]
#3And despite this public visibility of the object's struct members granted to provide inheritance, the examples are still using getters and setters.
Ok...
Re: Object-Oriented Programming in C (2019) [pdf]
#4Re: Object-Oriented Programming in C (2019) [pdf]
#5Unfortunately with this approach to inheritance PIMPL goes out the window, since the class structs are now all public to facilitate embedding... And despite this public visibility of the object's struct members granted to provide inheritance, the examples are still using getters and setters. Ok...
Re: Object-Oriented Programming in C (2019) [pdf]
#6Re: Object-Oriented Programming in C (2019) [pdf]
#72. Creating functions that take a pointer to the struct as the first parameter
3. Declaring a variable with that struct type to create an instance of the object
4. Declaring another variable with that struct type for another object instance
Re: Object-Oriented Programming in C (2019) [pdf]
#8If you need to do OOP in C, it's time to move to a more powerful language.
Re: Object-Oriented Programming in C (2019) [pdf]
#9Unfortunately with this approach to inheritance PIMPL goes out the window, since the class structs are now all public to facilitate embedding... And despite this public visibility of the object's struct members granted to provide inheritance, the examples are still using getters and setters. Ok...
("Free" after adding some metadata comments specifying parameter ownership/lifetimes, at least.)
Re: Object-Oriented Programming in C (2019) [pdf]
#10I think this approach is working too hard to realize Virtual Tables and Virtual Pointers. Another, different implementation is to define an array of function pointers, one function per method implemented, and then extend the array per subclass; each child class fills in its own or parents function pointers at init time.