delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/01/22:24:16

Date: Mon, 1 Dec 1997 21:23:15 -0600 (CST)
From: Andrew Deren <aderen AT eecs DOT uic DOT edu>
To: gilley <gilley AT netunlimited DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: C++ and globals ??
In-Reply-To: <34832B11.7408@netunlimited.net>
Message-ID: <Pine.SUN.3.95.971201212255.1698A-100000@ernie.eecs.uic.edu>
MIME-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019