Re: Global Variable or Not
From: Sigurd Stenersen (sigurds_at_utvikling.com)
Date: 09/30/04
- Next message: River Ross: "http status code text message"
- Previous message: Sigurd Stenersen: "Re: ComboBox issue..."
- In reply to: Macca: "Global Variable or Not"
- Next in thread: r norman: "Re: Global Variable or Not"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 30 Sep 2004 16:42:53 +0200
Macca wrote:
> In my application i have one class,Class A, which as the app is being
> run collects diagnostic information throughout the day and stores it
> in a vector.
>
> I have another class, Class B, that at the end of the day will take
> the contents of this vector, that has been built up over the day, and
> produces some excel reports from it.
>
> The problem i am having is how Class B accesses the vector that Class
> A is using.
>
> There is no relationship between the 2 classes.
> One way would be to declare the vector as a global variable that the
> two classes can access.
Which class does the vector belong to ? That is, who owns it ?
If A owns it and only A and B should be allowed to access it, you could make
it a protected member of A and make B a friend of A.
If neither A nor B own it, you could make a separate owner class C that
allows only A and B access to it.
Anyhow, just make something that works and move on to more important
issues...
-- Sigurd http://utvikling.com
- Next message: River Ross: "http status code text message"
- Previous message: Sigurd Stenersen: "Re: ComboBox issue..."
- In reply to: Macca: "Global Variable or Not"
- Next in thread: r norman: "Re: Global Variable or Not"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|