Inherit in c

 

Introduction


As you may know that already, there is no Class and inheritance concept in C. In this example, I am trying to simulate class inheritance in C. The reason I want to do this properly is I am too boring. 😆

Let’s have a look in the follow code example to see how I see pointer to simulate this behavior.

Code

Gitlab example

Result

$ ./app/Inherit_C/Inherit_C
I am an apple 001
We have 10 apples.
I am an orange 002


Comments