Skip to main content
gamedev.net
🔒 Locked

multiple base classes and lower-casing.

Started by GekkoCube Mar 15, 2003 at 11:16 AM 2 replies 150+ views
Original Post
GekkoCube
GekkoCube
First, the easy question... How can i lower-case an entire string? Second, the little bit harder question... I have a base class called CObject. I would also like to have a base class called CMesh. Then i plan on having classes (such as CModel3DS or CModelMD2) derive from base CMesh (which in turn derives from CObject). Is this legal and perfectly fine, to have two base classes, both having virtual and pure virtual functions?
civguy
civguy
quote:
Original post by GekkoCube
How can i lower-case an entire string?


    
#include <algorithm>

#include <string>

#include <cctype>


int main() {
std::string text="BnEh";
std::transform(text.begin(), text.end(), text.begin(), tolower);
}

quote:
I have a base class called CObject.
I would also like to have a base class called CMesh.
Then i plan on having classes (such as CModel3DS or CModelMD2) derive from base CMesh (which in turn derives from CObject).
Is this legal and perfectly fine, to have two base classes, both having virtual and pure virtual functions?
Yes.



[edited by - civguy on March 15, 2003 1:46:09 PM]
GekkoCube
GekkoCube
thanks alot.
but what is the function to lowercase letters from the #include <string> or #include <string.h>? I think it only requires one parameter.

And, having a base class that has virtual functions derivce from another base class...what is the requirement for the second base class as far as defining pure virtual functions?
Just simply declare the same thing and implement it in it''s derived classes?

Would this design, having a CObject, CMesh, and CModel, be a good design??? Or is the CMesh unecessary?
Zipster
Zipster
quote:
Original post by GekkoCube
thanks alot.
but what is the function to lowercase letters from the #include <string> or #include <string.h>? I think it only requires one parameter.

It''s _tolower, however it only does one character at a time. For a whole string, you''d have to write a loop using it, however that''s basically what the transform algorithm does for you. It''s the classier C++ loop

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.