Finally, we comes with the C# language. C# supports all OO features mentioned in previous articles in language level. So, our implementation is quite straight forward. Just check the source code in my skydrive: http://cid-481cbe104492a3af.office.live.com/browse.aspx/share/dev/TestOO. In the TestCSObject-{date}.zip file.
Lastly, I drew a simple table to compare and summarize the OO supports in the four leading languages:
C/gtk+ | C++/Qt | Java | C# | |
Basic Features | ||||
Encapsulation | library | good design | Y | Y |
Inheritance | library | Y | Y | Y |
Polymorphism | function pointer | Y | Y | Y |
Advanced Features | ||||
Property | library | library | reflection feature | Y |
Meta Info | library | library | annotations | attributes |
Event Driven | library(signals) | library(signals/slots) | events/listeners | delegates/events/handlers |
Measurements (Using a test application to demostrate above 5 features) | ||||
Compiler | mingw32-gcc/3.4 | mingw32-g++/3.4 | JDK/1.6.20 | VC#/2005 |
Library | gtk+/2.16.6 | Qt/4.3.5 | Java/6.0 | .NET/2.0 |
Source Size | 19.09 KB | 7.28 KB (+10.17 KB) * | 13.18 KB | 6.28 KB |
Binary Size | 32.69 KB | 34.00 KB | 9.48 KB | 5.50 KB |
Runtime Size | 1.46 MB | 2.00 MB | 15.54 MB | 23.84 MB |
* Generated source |
- Here’s the complete list of all articles regarding OO implementation in C, C++, Java & C#:
- OOP Using GObject (1) – A Fundamental Type
- OOP Using GObject (2) – A Classed Type
- OOP Using GObject (3) – An Instantiatable Class
- OOP Using GObject (4) – An Inheritable Class
- OOP Using GObject (5) – Private Members
- OOP Using GObject (6) – Properties
- OOP Using GObject (7) – Signals
- OOP Using GObject (8) – An interface
- OOP Using GObject (9) – A Dynamic Type
- OO Impelementation in C++
- OO Impelementation in Java
- OO Impelementation in C#