Mail Archives: djgpp/1997/12/01/21:16:13
gilley wrote:
> //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. :)
Not dumb, just... dunno. Wrong group, anyway.
Anyway, systemfont points to MyClass::myfont. Use scoping rules, member
variables are in the scope of member functions. To get at the global
myfont from a MyClass member function, use `::'. ie
void MyClass::afunction(void)
{
systemfont=::myfont;
};
Bill
--
Leave others their otherness
- Raw text -