SRB2 and object-oriented programming

Status
Not open for further replies.

Digiku

Member
I'm talking about SRB2's source:

So imagine if C was capable of classes (I know C++ is.) You know how a lot of SRB2's source files and functions are prefixed and the related functions all go under that same prefix? Do you think the source would have been better organized and used through classes (like "M::DrawMenuTitle()"), or is it really better off used classless as it is now (regular "M_DrawMenuTitle()")?

I ask because I'm wondering if organization is a valid use for classes. Is it better to use classes, or to divide functions only through files so that their scope is sort of "global"?
 
From an architectural point of view, it makes no difference. The only changes would be that each file would have class Whatever{} around it, and underscores would change to ::, except in the cases of intra-class calls where the prefixes would just disappear. The underlying design would be the same.
 
Things that use scope in C++ are utilizing namespaces, not classes.

Namespaces can be nice, but it's also a lot of extra typing.

As for classes, SRB2 already uses structs with pointers to functions and other structs, which is pretty much the verbose version of inheritance in C.
 
Nah, I never said anything about that. It was more a general question than anything. :P Thanks guys.
 
Watch out. Maybe some compilers can go with it, but C++ is normally better than C. Also, make sure you use a real C++ compiler, because most compilers just convert from C++ to C and then compile it, hence making slower code.

By the way, classes suck. Also, classes are not intended to work that way (through they can be used that way). It would be better if it was some prefix.name convention rather than a prefix::name convention by your means, through.
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top