Friday, October 2, 2009

Oops

I am kind of embarrassed to talk about this but I feel that if I don’t then this little blog will die out before it has even started to blossom. Every programmer makes mistakes and that is why we have syntax highlighting and fast compilers. Not every little bug is going to be caught until the product is released because no matter how smart a programmer is the user is dumber. Sometimes a programmer makes a big mistake that makes him feel like a complete moron. Be it a syntax error as small a missing semicolon or one as large as completely breaking their file structure. Other programmers have done this too, right?

For those of you not familiar with C++ let me set this out. C++ is also called C With Classes mainly because it is, in all regards, C with classes. Anything you can do in C you can do in C++ with the option of using classes. This isn’t the same situation with C# which I will be learning soon I am told.

So in C++ you are suppose to separate the declaration of your classes from the actually implementation of said classes. What this basically means is you are suppose to have a file call a header that contains what is akin to a warning.

Yo! C++, we are about to have a class called Menu.

Basically. Kind of. Not Really.

Ok in another file you have the actual class functions of the class. These are usually much longer. They are longer because they are the meat and potatoes of the the whole thing. The big problem comes with the fact that sometimes you REALLY need to have part of the class compile more then once but you can almost never let another part of the class compile twice. My bad.

Just recently I failed to do this correctly. I put the header stuff where the body should have been and vice versa. Want to know what happens? LOTS of errors. Also, the virtual function table explodes. Which is sad.




- A. R. McGowan.


R.I.P. Virtual Function Tables

1 comment:

Post a Comment