In object-oriented programming, I know you can pass control between classes, which makes things much more organized. I realize that there aren’t classes in C because it isn’t an object-oriented programming language, but is there a way that I can write a new file, that I can pass control to? Just to make things easier?
What I’m really asking is : how do I pass control to an outside extension of the program, and do I need to use any special type of program (.dll, etc.)
Basically, C++ does not introduce much in the sence of program structure organization when compared to C.
You don’t really pass controll between classes in C++. You just call methods of classes. Class methods are just functions with several additional capabilities. Thus you can use the same tactics of passing control in C as you do in C++. For example:
The only problem, you may need more effort to structurize your program in C when compared to C++. For example, the latter language will take care about proper initialization and destruction of objects, while in C you have to take care of such stuff yourself.
As for using static and/or dynamic libraries, the 2 languages are mostly identical. You will have more trouble when trying to make C++ libraries portable to other compiler and/or platform though due to many subtle differences like function names mangling, vtables and stuff like that.