Could a class call a system function when it has a member function with equal name?

Back to topics list To post a new topic, please log in or register
avatar
5
pantarhei 2015.10.02 09:52
 

I like to create a file handling class. It would be nice if some member functions could have the same names like the normal file handling functions, i.e. FileWrite, FileRead. But a class would always call the member functions with that name and it would not be possible to call the normal functions.

Is there something like a namespace „system“ or something similar, to call the normal file functions?


An example:


Class x

{

private:

  void   SyncToCloud();

public:

        x();

        ~x();

  void   FileWrite();

  void   FileRead();

};


None of the member functions would be able to call FileWrite(), because the class would search for a member function with that name. If member function x::FileWrite() would call FileWrite() a recursive call would occur and maybe an endless loop.



avatar
12988
WHRoeder 2015.10.02 14:16 #
 

The member function is x::FileWrite() which is how you call outside a member function it if it was a static function.

The global function is ::FileWrite()

Back to topics list  

To add comments, please log in or register