• Stars
    star
    159
  • Rank 235,879 (Top 5 %)
  • Language
    C
  • License
    MIT License
  • Created almost 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simple and efficient implementation of OOP in C suitable for real-time embedded systems.

Brought to you by:

Quantum Leaps


GitHub release (latest by date) GitHub

Object-Oriented Programming in C

This repository provides the code accompanying the article: "Object-Oriented Programming". The code can be compiled and executed on any desktop computer (running Windows, Linux, or macOS).

Here is the code structure:

OOP-in-C/
+---doc/
¦       AN_OOP_in_C.pdf
¦
+---encapsulation/
¦       main.c
¦       make.bat
¦       shape.c
¦       shape.h
¦
+---inheritance/
¦       main.c
¦       make.bat
¦       rect.c
¦       rect.h
¦       shape.c
¦       shape.h
¦
+---polymorphism/
        circle.c
        circle.h
        main.c
        make.bat
        rect.c
        rect.h
        shape.c
        shape.h

Building and Running the Code

Each of the sub-directories contains make.bat (for Windows) that allows you to build and run the provided examples. (On Linux/macOS you can execute the commands from make.bat directly from the tarminal).

For example:

C:\GitHub\OOP-in-C>cd encapsulation
C:\GitHub\OOP-in-C\encapsulation>make

gcc shape.c main.c -o oop_in_c
oop_in_c

Shape s1(x=0,y=1)
Shape s2(x=-1,y=2)
Shape s1(x=2,y=-3)
Shape s2(x=0,y=0)

Videos

The concepts of OOP in C have been explained in a series of videos:

The PDF Version

The PDF version of the "Object-Oriented Programming" article is provided in the directory doc

Object-Oriented Programming in C

Licensing

The OOP-in-C source code and examples are released under the terms of the permissive MIT open source license. Please note that the attribution clause in the MIT license requires you to preserve the original copyright notice in all changes and derivate works.

How to Help this Project?

If you like this project, please give it a star (in the upper-right corner of your browser window):

GitHub star

Contact Information

More Repositories

1

qpc

QP/C Real-Time Embedded Framework/RTOS for embedded systems based on active objects (actors) and hierarchical state machines
C
788
star
2

modern-embedded-programming-course

Companion repository to the "Modern Embedded Systems Programming" video course.
C
358
star
3

qpcpp

QP/C++ Real-Time Embedded Framework/RTOS for embedded systems based on active objects (actors) and hierarchical state machines
C++
316
star
4

qpn

QP-nano real-time embedded framework/RTOS for embedded systems based on active objects (actors) and hierarchical state machines
C
148
star
5

qtools

QTools collection of open source tools for embedded systems development on Windows, Linux and MacOS
C
113
star
6

Super-Simple-Tasker

Event-driven, preemptive, priority-based, hardware RTOS for ARM Cortex-M.
C
111
star
7

qm

QM model-based design tool and code generator based on UML state machines
Shell
107
star
8

MiROS

MiROS (Minimal Real-Time Operating System) for ARM Cortex-M
C
65
star
9

FreeAct

FreeAct is a minimal Active Object (Actor) framework for FreeRTOS
C
65
star
10

lock-free-ring-buffer

"Lock-Free Ring Buffer" (LFRB) is a minimal, customizable implementation of a ring buffer (a.k.a. circular buffer) in C, specifically suitable for embedded systems.
C
60
star
11

qp-arduino

QP real-time embedded frameworks/RTOS for Arduino (AVR and SAM)
C++
41
star
12

State-Oriented-Programming

State-Oriented Programming: was a cover story article about Hierarchical State Machines in C and C++ published originally in "Embedded Systems Programming" magazine in August 2000. This repository contains the article PDF and the updated code.
C
25
star
13

embedded-coding-style

Embedded C and C++ Coding Style
CSS
14
star
14

Embedded-Test

Embedded Test (ET) -- The Super-Simple Embedded Test
C
8
star
15

DBC-for-embedded-C

Design By Contract (DBC) for embedded C and C++
C
4
star
16

qpc-zephyr-app

Example project and starting point for creating QP/C-Zephyr applications.
C
4
star
17

contributed

Software contributed to the QP framework ecosystem
3
star
18

qpcpp-zephyr-app

Example project and starting point for creating QP/C++-Zephyr applications.
C++
3
star
19

3rd_party

3rd-party code used in the QP/C and QP/C++ examples
C
2
star
20

cmsis-packs

CMSIS packs released by Quantum Leaps
2
star
21

spexygen

Traceable specifications based on Doxygen
CSS
2
star
22

ql-doxygen

Doxygen customization based on doxygen-awesome-css
CSS
2
star
23

spexygen1

Traceable specifications based on Doxygen.
CSS
2
star
24

ET

ET (Embedded Test) -- The Super-Simple Embedded Test
C
1
star
25

.github

Quantum Leaps' profile
1
star