|
-
Jan 7th, 2009, 09:05 AM
#1
Thread Starter
Frenzied Member
Sub class?
How is something like this setup?
I have a bunch of functions in this class like
AClass->Func()
and I want to organize them.
AClass->Mask::Func()
How do I do that? Would I just put Func() in a static class inside AClass?
-
Jan 12th, 2009, 06:42 AM
#2
Fanatic Member
Re: Sub class?
If you have that many functions in your AClass class I think it's time you rethink your design...
Never argue with fools, they will only drag you down to their level, and beat you with experience.
Q: How do you tell an experienced hacker from a novice?
A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer
-
Jan 12th, 2009, 11:14 AM
#3
Thread Starter
Frenzied Member
Re: Sub class?
 Originally Posted by McCain
If you have that many functions in your AClass class I think it's time you rethink your design...
Well they are all virtual and splitting the class would become a headache for setting them all.
Right now I am doing.
Code:
class TextClass
{
};
TextClass Text;
Probably will change "TextClass" to "TEXT".
also there aren't that many functions, I just want them more organized.
I don't get how you could separate them nicely.
I mean, the user currently accesses them like.
Code:
void OnReceiveText(InsimInterface::TextClass::ReceiveTextStruct rts)
{
}
Insim->Text.OnReceiveText(&OnReceiveText);
 Originally Posted by McCain
If you have that many functions in your AClass class I think it's time you rethink your design...
That really isn't a suggestion to how to improve so... What would you suggest I do?
-
Jan 12th, 2009, 12:08 PM
#4
Fanatic Member
Re: Sub class?
From the look of your reply it seems like you're designing some kind of library or something. This is always hard and requires you to have a good idea of how it should all look and work before you start coding.
From your original example I would suggest you create the (separate) class AMaskClass instead of having the class Mask inside AClass.
Never argue with fools, they will only drag you down to their level, and beat you with experience.
Q: How do you tell an experienced hacker from a novice?
A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|