Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Global instances inside class

Reply
Thread Tools

Global instances inside class

 
 
Krice
Guest
Posts: n/a
 
      04-05-2008
My Window class is using Tileset class to draw the window borders.
Tileset is a global instance set up earlier:

extern Tileset *window_borders;

void Window::Show()
{
//some code...
window_borders->Draw(x,y,tile);
//etc...

This is bad, isn't it? At least it makes Window class dependent of
that
global Tileset instance. The only alternative solution I can think of
is
passing a pointer to Tileset in Window constructor, but it seems funny
to
do that, because there is only one instance of Tileset for window
borders.
Is this problem at all or is there some other way to do this?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dicts,instances,containers, slotted instances, et cetera. ocschwar@gmail.com Python 8 01-29-2009 09:52 AM
FWSM/PIX and Dynamic PAT using global IP range vs. global interface vs. global IP Hoffa Cisco 1 10-25-2006 06:50 PM
FWSM/PIX and Dynamic PAT using global IP range vs. global interface vs. global IP Hoffa Cisco 0 10-25-2006 01:04 PM
Nested Class, Member Class, Inner Class, Local Class, Anonymous Class E11 Java 1 10-12-2005 03:34 PM
list of class instances within a list of a class instances John Wohlbier Python 2 02-22-2004 08:41 AM



Advertisments