Scope of file in classes


#1

Hi everyone,

I am not so experienced in OOP, maybe that’s why I have following problem:

I wrote a programm that uses 2 classes. In both classes I access the same file, so I put the file definition in both class modules - between member() and code.

But after compiling the linker complains about „duplicate symbol“, because the file definition occurs in both classes.

I tried to remove the file from the class modules and put it into the main PROGRAM source.
But then the compiler comes up with „unknown identifier“ and „no matching prototype available“ when accessing the file.
… what I honestly don’t understand because I made the file „global“. The scope of a global file definition doesn’t seem to reach into the class object. But okay, this was just an attempt to understand the compiler’s logic – vain endeavor :wink:

Maybe someone can enlighten me, where would be the best place to define files when using them in many procedures seperatly? (I don’t think this is a pure OOP problem)

Thanks for a hint!
Regards, Torsten