Hi guys!
Yes, I know about C++, about Python, Java, and others object-oriented programing language. But now I want talking only about ANSI C - yes, it is not OOP language, but when I read the book Schreiner, Axel-Tobias,.. Object oriented programming with ANSI-C - I am very interested in this idea!
ANSI C program I began write relatively recently. And I'm sorry if something would look corny and stupid. I look forward to your help, perhaps you will share your thoughts about it.
My English very bad - therefore please be patience!
For ease of presentation ideas I will only use the header files.
Okay, we need emulate new operator and delete() function with C++. We should be have initialization point for our objects. Our objects must be have class description. So, - Go!
File objectmode.h has class prototype, and new/delete emulation.
See the description here.
Now, for example, create simple class - human.
See the description here.
It's time to check how it works.
The main program can be found here, and Makefile - here.
Run result:
What I want from you?
I am interested in your opinion about it! I am interested in your advice about it!
Thanks All.
P.S. You want to scream - scream. Do you want to insult - insult. Do you want to cry - it's your business. But do not forget to leave a comment about it.
Yes, I know about C++, about Python, Java, and others object-oriented programing language. But now I want talking only about ANSI C - yes, it is not OOP language, but when I read the book Schreiner, Axel-Tobias,.. Object oriented programming with ANSI-C - I am very interested in this idea!
ANSI C program I began write relatively recently. And I'm sorry if something would look corny and stupid. I look forward to your help, perhaps you will share your thoughts about it.
My English very bad - therefore please be patience!
For ease of presentation ideas I will only use the header files.
Okay, we need emulate new operator and delete() function with C++. We should be have initialization point for our objects. Our objects must be have class description. So, - Go!
File objectmode.h has class prototype, and new/delete emulation.
See the description here.
Now, for example, create simple class - human.
See the description here.
It's time to check how it works.
The main program can be found here, and Makefile - here.
Run result:
Code:
% ./oodmain
Manager.
Age: 32.
Name: Jim K..
Secretary.
Age: 32.
Name: Sara M..
New peaople.
Manager.
Age: 21.
Name: Dasha N..
%
What I want from you?
I am interested in your opinion about it! I am interested in your advice about it!
Thanks All.
P.S. You want to scream - scream. Do you want to insult - insult. Do you want to cry - it's your business. But do not forget to leave a comment about it.