[C++Design]Wrapping many classes in one,a question.

Started by
1 comment, last by Erius 14 years, 2 months ago
Hi. So I rewrote most of my engine components so that they are not dependent on each other, but still have nice and comfortable means of communication. Still, it seems that putting them all into a final class seems like a good idea. Is it really, though? Also do I get any considerable penalties by declaring all the components as pointers? Or well, more precisely, does it mess up the prediction capabilities of the CPU? Anyway, in case I suck at explaining, which might be likely:

class system
{
input * input;
gui * gui;
rendering * rendering;
};



Etc. Yes, shameful, since it should be elemental to know the architecture of it all, but I don't remember if there was any penalty for class.member->function(); calls vs direct ones, or virtual ones. I googled, but all I got was talk about member function pointers, and I know how to write and work with those. Thanks in advance... [Edited by - Erius on February 18, 2010 10:12:18 AM]
Advertisement
Quote:
Also do I get any considerable penalties by declaring all the components as pointers?
Or well, more precisely, does it mess up the prediction capabilities of the CPU?
...
I don't remember if there was any penalty for class.member->function(); calls vs direct ones, or virtual ones.

This is a pointless concern. Whatever performance issues exist will be so trivial and so fickle that it's not worth worrying about. Instead, focus on the larger issue: do you need this "system" class? What does it gain you? Why are you doing it?
I wanted to edit my motivation in, but I cannot, for the life of me, remember the word that describes rearranging something in a way so the functionality is basically the same way, yet changes the way it is structured, or something.
(Drives me up the wall actually, so I'll be using 'looks' for the moment)

I'm so brain dead at this moment (Switched IDE's, had way too much sleep, yet also way too much caffeine, but not enough food) that I decided to not do any further coding today, but it did dawn on me that I won't gain too much by doing it that way, since it would only shift things to some other place, and at most, might make it easier to work with some passed variables, but yeah.

Well, at least you validated my general view about the pointer issue, so I wont worry about that.
Thank you.

And now I shall administer some figurative 9mm aspirin to my brain...ugh.

This topic is closed to new replies.

Advertisement