Mail Archives: djgpp/1997/12/01/22:24:16
You can use ::variable to refer to global variables inside a method
On Mon, 1 Dec 1997, gilley wrote:
> Here is a simple C++ question.
> I forget how this works. Would some one
> refresh my memory.
>
> //***Example***//
>
> //globals
> FONT *myfont;
> FONT *systemfont;
>
> class MyClass
> {
> Font *myfont;
> void afunction(void);
>
> };
> void MyClass::afunction(void)
> {
> systemfont=myfont;
> };
>
> OK now the question is.. in afunction()
> is the systemfont now poining to MyClass.myfont
> or is it pointing to the global myfont?
>
> How do I distinguish the two? Should I say
> This.myfont to be sure I am getting the myfont
> var in the class?
>
> Thanks all,
> I know its a dumb question. :)
>
,,,
(0 0)
+-------------oOO----(_)-------------------+
| Andrew Deren |
| aderen AT eecs DOT uic DOT edu |
| www.eecs.uic.edu/~aderen/ader/main.html |
+-------------------------oOO--------------+
|| ||
ooO Ooo
- Raw text -