
OOP Basecode Question
Alright, I''m playing around with the different types of basecodes, and I have always liked the concepts of OOP/D. While I understand (in my eyes) much of it, I seem to have come to a bit of a...brick wall; I can''t figure out how to get at the Device Context globally, which conveniently nested inside of a class. I tried to create another class using the GL_Window class as a friend to another class and accessing it through a get_hdc() function. I can''t post the code, which probably won''t help much...but if anyone can help, please do. Have fun y''all.
BTW, I''m really sleepy right now, so if any of this is...uh...incomprehensible (dictionary.com
) then say something about it and I''ll get back to you...later.
"TV IS bad Meatwad...but we f***in need it"

Things change.
Hi,
if you want to make a good OO Design, you need to look up the different Design Patterns.
For accessing Global Objects especialy the 'Singleton' Pattern.
I think Mr. Google will show you a lot info on that Topic.
A book i can recommend is:
Design Patterns by Erich Gamma
Lazzar
[edited by - Lazzar on February 25, 2004 6:54:20 AM]
if you want to make a good OO Design, you need to look up the different Design Patterns.
For accessing Global Objects especialy the 'Singleton' Pattern.
I think Mr. Google will show you a lot info on that Topic.
A book i can recommend is:
Design Patterns by Erich Gamma
Lazzar
[edited by - Lazzar on February 25, 2004 6:54:20 AM]
---------------------------------------------------------if god gave us the source code, we could change the world!
Even though your question is a bit vague, I''ll give it a blind shot.
If your problem looks like this:
In the hilighted line, the :: before the function name causes the global version of the function to be called so there isn''t a clash between Window::GetDC() and WinAPI''s GetDC().
If you had something else in mind, please elaborate a little!
If your problem looks like this:
class Window{ private: HWND Handle; public: HDC GetDC(); };HDC Window::GetDC(){ reutrn ::GetDC(Handle); //<-}
In the hilighted line, the :: before the function name causes the global version of the function to be called so there isn''t a clash between Window::GetDC() and WinAPI''s GetDC().
If you had something else in mind, please elaborate a little!
"Finishing in second place, simply means you are the first loser." - PouyaCat
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
Ok, I got it workin. Thanks a lot Crispy...wasn''t EXACTLY the solution I was looking for, but the concept was just about the same...I ended up using a bit of the global scope thing and static class members. I''ll look up that thing you mentioned Lazzar. Thanks!
"TV IS bad Meatwad...but we f***in need it"
"TV IS bad Meatwad...but we f***in need it"
Things change.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement