Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Stayin' home on a Satuday night

Sign in to follow this  


My girlfriend's bartending for a wedding tonight so I'm stayin' home and cleanig up some old code that I need to use on my project. Not much to report, really. I've just worked on the structure of my main application and, so far, so good. I also cleaned up the "action processor" that I'm using to handle actions that need to be executed in my main thread. Since it's a precursor to a virtual machine I'd like to implement later on, it's important that it's squeaky clean. =)


On a personal note, I'm having trouble convincing people of the size of the monster that lives with me so I thought I'd use my web space to temporarily post a pic. He's a black Maine Coon cat. The table that he's standing on is about 3 1/2 ft. in diameter. I don't know if you guys have ever seen a Maine Coon but they're enormous. Everyone, I'm pleased to introduce Lucky:

I came to a realization. When dealing with factory methods, there's a way to insure that the factory method of you child calsses are implemented.

I have a CAction class with a factory method. I use a CActionProcessor object that registers, maps and executes CAction objects. CAction is an abstract class and requires that the Factory method is implemented. Instead of using a stub in the parent class, the parent class simply returns NULL. This works well where you want to use the CAction class for a different solution but still want a default Factory method to get it to compile. So if I say

CAction * Factory () = 0;

in the header file, I can't compile without implenting the method. On the other hand, I can impliment it as such:

CAction *CAction::Factory () {
return NULL;

Now I can instantiate the class without worrying about the Factory method but my CActionProcessor class will ignore anything that returns NULL. In some applications, this could be a little messier and the previous stub would be a better fit. I just kinda dig this option because it allows a bit more flexibility.
Sign in to follow this  


Recommended Comments

Dude, my cat's name is Lucky too. But it's gray and white... and small... nevermind.

Share this comment

Link to comment
Hey man, it's not the size of your Lucky that counts. It's how you use it. =b

Share this comment

Link to comment
You know I gotta feed his a$$ on time. If not, I might wake up without a leg or sumthin'. [disturbed]

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!