Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Help wanted. C++ question.

Name: Anonymous 2009-07-13 17:49

How do I declare a global object 'within' the class's brackets?

class Box{

public:
int x, y;
//Here's the problem.
Box A;//?

bool collision(Box A, Box B){}

}A, B;

Is it even possible to declare global objects within a class? Yes/no? Depending on your answer I may:
 
a) Drop out of college and become a plumber.
b) Kill myself.
c) Finish the app I'm currently working on.

Name: Op 2009-07-13 22:27

>>30
Alright, I finally realize I've been doing it wrong for all of these years. Only now do I realize I had a bastardized interpretation of C++ classes, objects, and functions. I've always thought of the class itself as one giant object.

Thanks for the enlightenment brodo. And just for the record, even though I'm new to C++ I've been coding on and off for a few years. I was never really stuck on this project, nor have I ever been stock on any of my projects in terms of syntax and logic.

Being the blatant neat freak that I am, I amateurishly tried to stuff everything related to my Box class within the Box class, with little regard to common sense.

Now let's pretend like this thread never happened, alright? And by that I mean, let it die miserably. Lesson learned, C++ is significantly more complex than some of the other user friendly languages out there. You cant just start dicking around with it - hoping that it'll work. Next time I'll allocate more than two weeks of study time to learn a new language.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List