Skip to content

Commit 90c6905

Browse files
committed
0.5.0
Changed LICENSE from restrictive GPL to permissive MIT
1 parent 7aeda01 commit 90c6905

File tree

20 files changed

+357
-951
lines changed

20 files changed

+357
-951
lines changed

LICENSE

Lines changed: 21 additions & 674 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,45 @@
11
## Brought to you by:
22
[![Quantum Leaps](https://www.state-machine.com/attachments/logo_ql_400.png)](https://www.state-machine.com)
3+
<hr>
34

4-
---------------------------------------------------------------------
5-
[![Object-Oriented Programming in C](img/thumbnail.jpg)](https://www.state-machine.com/oop)
5+
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/QuantumLeaps/OOP-in-C)](https://github.com/QuantumLeaps/OOP-in-C/releases/latest)
6+
[![GitHub](https://img.shields.io/github/license/QuantumLeaps/OOP-in-C)](https://github.com/QuantumLeaps/OOP-in-C/blob/master/LICENSE)
67

7-
# The Accompanying Code
8+
9+
# Object-Oriented Programming in C
810
This repository provides the code accompanying the article:
911
["Object-Oriented Programming"](https://www.state-machine.com/oop).
1012
The code can be compiled and executed on any desktop
1113
computer (running Windows, Linux, or macOS).
1214

15+
<p align="center"><img src="img/thumbnail.jpg"/></p>
16+
1317
Here is the code structure:
1418

1519
```
16-
OOP-in-C
17-
+---doc
20+
OOP-in-C/
21+
+---doc/
1822
¦ AN_OOP_in_C.pdf
1923
¦
20-
+---encapsulation
24+
+---encapsulation/
2125
¦ main.c
2226
¦ make.bat
23-
¦ oop_in_c.exe
2427
¦ shape.c
2528
¦ shape.h
2629
¦
27-
+---inheritance
30+
+---inheritance/
2831
¦ main.c
2932
¦ make.bat
30-
¦ oop_in_c.exe
3133
¦ rect.c
3234
¦ rect.h
3335
¦ shape.c
3436
¦ shape.h
3537
¦
36-
+---polymorphism
38+
+---polymorphism/
3739
circle.c
3840
circle.h
3941
main.c
4042
make.bat
41-
oop_in_c.exe
4243
rect.c
4344
rect.h
4445
shape.c
@@ -75,13 +76,20 @@ The concepts of OOP in C have been explained in a series of videos:
7576

7677

7778
# The PDF Version
78-
The PDF version of the
79-
["Object-Oriented Programming" article](https://www.state-machine.com/oop)
79+
The PDF version of the
80+
["Object-Oriented Programming" article](doc/AN_OOP_in_C.pdf)
8081
is provided in the directory `doc`
8182

8283
[![Object-Oriented Programming in C](img/AN_OOP-in-C.jpg)](doc/AN_OOP_in_C.pdf)
8384

8485

86+
# Licensing
87+
The OOP-in-C source code and examples are released under the terms of the
88+
permissive [MIT open source license](LICENSE). Please note that the
89+
attribution clause in the MIT license requires you to preserve the
90+
original copyright notice in all changes and derivate works.
91+
92+
8593
# How to Help this Project?
8694
If you like this project, please give it a star (in the upper-right corner of your browser window):
8795

encapsulation/main.c

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
1-
/*****************************************************************************
2-
* Code accompanying the Application Note:
1+
/*============================================================================
2+
* Code accompanying the Article:
33
* "Object-Oriented Programming in C"
4-
* https://www.state-machine.com/doc/AN_OOP_in_C.pdf
4+
* https://github.com/QuantumLeaps/OOP-in-C
55
*
6-
* Copyright (C) 2005-2018 Quantum Leaps. All Rights Reserved.
6+
* Copyright (C) 2006-2023 Quantum Leaps, <state-machine.com>.
77
*
8-
* This program is free software: you can redistribute it and/or modify
9-
* it under the terms of the GNU General Public License as published by
10-
* the Free Software Foundation, either version 3 of the License, or
11-
* (at your option) any later version.
8+
* SPDX-License-Identifier: MIT
129
*
13-
* This program is distributed in the hope that it will be useful,
14-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16-
* GNU General Public License for more details.
10+
* Permission is hereby granted, free of charge, to any person obtaining a
11+
* copy of this software and associated documentation files (the "Software"),
12+
* to deal in the Software without restriction, including without limitation
13+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
14+
* and/or sell copies of the Software, and to permit persons to whom the
15+
* Software is furnished to do so, subject to the following conditions:
1716
*
18-
* You should have received a copy of the GNU General Public License
19-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
* The above copyright notice and this permission notice shall be included in
18+
* all copies or substantial portions of the Software.
2019
*
21-
* Contact Information:
22-
* https://www.state-machine.com
23-
****************************************************************************/
24-
20+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26+
* DEALINGS IN THE SOFTWARE.
27+
============================================================================*/
2528
#include "shape.h" /* Shape class interface */
2629
#include <stdio.h> /* for printf() */
2730

encapsulation/oop_in_c.exe

-288 KB
Binary file not shown.

encapsulation/shape.c

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
1-
/*****************************************************************************
2-
* Code accompanying the Application Note:
1+
/*============================================================================
2+
* Code accompanying the Article:
33
* "Object-Oriented Programming in C"
4-
* https://www.state-machine.com/doc/AN_OOP_in_C.pdf
4+
* https://github.com/QuantumLeaps/OOP-in-C
55
*
6-
* Copyright (C) 2005-2018 Quantum Leaps. All Rights Reserved.
6+
* Copyright (C) 2006-2023 Quantum Leaps, <state-machine.com>.
77
*
8-
* This program is free software: you can redistribute it and/or modify
9-
* it under the terms of the GNU General Public License as published by
10-
* the Free Software Foundation, either version 3 of the License, or
11-
* (at your option) any later version.
8+
* SPDX-License-Identifier: MIT
129
*
13-
* This program is distributed in the hope that it will be useful,
14-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16-
* GNU General Public License for more details.
10+
* Permission is hereby granted, free of charge, to any person obtaining a
11+
* copy of this software and associated documentation files (the "Software"),
12+
* to deal in the Software without restriction, including without limitation
13+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
14+
* and/or sell copies of the Software, and to permit persons to whom the
15+
* Software is furnished to do so, subject to the following conditions:
1716
*
18-
* You should have received a copy of the GNU General Public License
19-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
* The above copyright notice and this permission notice shall be included in
18+
* all copies or substantial portions of the Software.
2019
*
21-
* Contact Information:
22-
* https://www.state-machine.com
23-
****************************************************************************/
24-
20+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26+
* DEALINGS IN THE SOFTWARE.
27+
============================================================================*/
2528
#include "shape.h" /* Shape class interface */
2629

2730
/* constructor implementation */

encapsulation/shape.h

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
1-
/*****************************************************************************
2-
* Code accompanying the Application Note:
1+
/*============================================================================
2+
* Code accompanying the Article:
33
* "Object-Oriented Programming in C"
4-
* https://www.state-machine.com/doc/AN_OOP_in_C.pdf
4+
* https://github.com/QuantumLeaps/OOP-in-C
55
*
6-
* Copyright (C) 2005-2017 Quantum Leaps. All Rights Reserved.
6+
* Copyright (C) 2006-2023 Quantum Leaps, <state-machine.com>.
77
*
8-
* This program is free software: you can redistribute it and/or modify
9-
* it under the terms of the GNU General Public License as published by
10-
* the Free Software Foundation, either version 3 of the License, or
11-
* (at your option) any later version.
8+
* SPDX-License-Identifier: MIT
129
*
13-
* This program is distributed in the hope that it will be useful,
14-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16-
* GNU General Public License for more details.
10+
* Permission is hereby granted, free of charge, to any person obtaining a
11+
* copy of this software and associated documentation files (the "Software"),
12+
* to deal in the Software without restriction, including without limitation
13+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
14+
* and/or sell copies of the Software, and to permit persons to whom the
15+
* Software is furnished to do so, subject to the following conditions:
1716
*
18-
* You should have received a copy of the GNU General Public License
19-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
* The above copyright notice and this permission notice shall be included in
18+
* all copies or substantial portions of the Software.
2019
*
21-
* Contact Information:
22-
* https://www.state-machine.com
23-
****************************************************************************/
20+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26+
* DEALINGS IN THE SOFTWARE.
27+
============================================================================*/
2428
#ifndef SHAPE_H
2529
#define SHAPE_H
2630

inheritance/main.c

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
1-
/*****************************************************************************
2-
* Code accompanying the Application Note:
1+
/*============================================================================
2+
* Code accompanying the Article:
33
* "Object-Oriented Programming in C"
4-
* https://www.state-machine.com/doc/AN_OOP_in_C.pdf
4+
* https://github.com/QuantumLeaps/OOP-in-C
55
*
6-
* Copyright (C) 2005-2018 Quantum Leaps. All Rights Reserved.
6+
* Copyright (C) 2006-2023 Quantum Leaps, <state-machine.com>.
77
*
8-
* This program is free software: you can redistribute it and/or modify
9-
* it under the terms of the GNU General Public License as published by
10-
* the Free Software Foundation, either version 3 of the License, or
11-
* (at your option) any later version.
8+
* SPDX-License-Identifier: MIT
129
*
13-
* This program is distributed in the hope that it will be useful,
14-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16-
* GNU General Public License for more details.
10+
* Permission is hereby granted, free of charge, to any person obtaining a
11+
* copy of this software and associated documentation files (the "Software"),
12+
* to deal in the Software without restriction, including without limitation
13+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
14+
* and/or sell copies of the Software, and to permit persons to whom the
15+
* Software is furnished to do so, subject to the following conditions:
1716
*
18-
* You should have received a copy of the GNU General Public License
19-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
* The above copyright notice and this permission notice shall be included in
18+
* all copies or substantial portions of the Software.
2019
*
21-
* Contact Information:
22-
* https://www.state-machine.com
23-
****************************************************************************/
24-
20+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26+
* DEALINGS IN THE SOFTWARE.
27+
============================================================================*/
2528
#include "rect.h" /* Rectangle class interface */
2629
#include <stdio.h> /* for printf() */
2730

inheritance/oop_in_c.exe

-288 KB
Binary file not shown.

inheritance/rect.c

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
1-
/*****************************************************************************
2-
* Code accompanying the Application Note:
1+
/*============================================================================
2+
* Code accompanying the Article:
33
* "Object-Oriented Programming in C"
4-
* https://www.state-machine.com/doc/AN_OOP_in_C.pdf
4+
* https://github.com/QuantumLeaps/OOP-in-C
55
*
6-
* Copyright (C) 2005-2017 Quantum Leaps. All Rights Reserved.
6+
* Copyright (C) 2006-2023 Quantum Leaps, <state-machine.com>.
77
*
8-
* This program is free software: you can redistribute it and/or modify
9-
* it under the terms of the GNU General Public License as published by
10-
* the Free Software Foundation, either version 3 of the License, or
11-
* (at your option) any later version.
8+
* SPDX-License-Identifier: MIT
129
*
13-
* This program is distributed in the hope that it will be useful,
14-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16-
* GNU General Public License for more details.
10+
* Permission is hereby granted, free of charge, to any person obtaining a
11+
* copy of this software and associated documentation files (the "Software"),
12+
* to deal in the Software without restriction, including without limitation
13+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
14+
* and/or sell copies of the Software, and to permit persons to whom the
15+
* Software is furnished to do so, subject to the following conditions:
1716
*
18-
* You should have received a copy of the GNU General Public License
19-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
* The above copyright notice and this permission notice shall be included in
18+
* all copies or substantial portions of the Software.
2019
*
21-
* Contact Information:
22-
* https://www.state-machine.com
23-
****************************************************************************/
24-
20+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26+
* DEALINGS IN THE SOFTWARE.
27+
============================================================================*/
2528
#include "rect.h"
2629

2730
/* constructor implementation */

inheritance/rect.h

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
1-
/*****************************************************************************
2-
* Code accompanying the Application Note:
1+
/*============================================================================
2+
* Code accompanying the Article:
33
* "Object-Oriented Programming in C"
4-
* https://www.state-machine.com/doc/AN_OOP_in_C.pdf
4+
* https://github.com/QuantumLeaps/OOP-in-C
55
*
6-
* Copyright (C) 2005-2017 Quantum Leaps. All Rights Reserved.
6+
* Copyright (C) 2006-2023 Quantum Leaps, <state-machine.com>.
77
*
8-
* This program is free software: you can redistribute it and/or modify
9-
* it under the terms of the GNU General Public License as published by
10-
* the Free Software Foundation, either version 3 of the License, or
11-
* (at your option) any later version.
8+
* SPDX-License-Identifier: MIT
129
*
13-
* This program is distributed in the hope that it will be useful,
14-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16-
* GNU General Public License for more details.
10+
* Permission is hereby granted, free of charge, to any person obtaining a
11+
* copy of this software and associated documentation files (the "Software"),
12+
* to deal in the Software without restriction, including without limitation
13+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
14+
* and/or sell copies of the Software, and to permit persons to whom the
15+
* Software is furnished to do so, subject to the following conditions:
1716
*
18-
* You should have received a copy of the GNU General Public License
19-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
* The above copyright notice and this permission notice shall be included in
18+
* all copies or substantial portions of the Software.
2019
*
21-
* Contact Information:
22-
* https://www.state-machine.com
23-
****************************************************************************/
20+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26+
* DEALINGS IN THE SOFTWARE.
27+
============================================================================*/
2428
#ifndef RECT_H
2529
#define RECT_H
2630

0 commit comments

Comments
 (0)