0
My program is structured as follows :
Classe.cpp
// Implementation of class methods
Classe.hpp
// Prototypes of the class
Main.cpp
// Main file
In my file Classe.hpp
I have the prototype a function friend
:
friend int mdc(int, int);
The implementation of this function is in Main.hpp
, the question here is : how can I use this function in my file Classe.cpp
?
I tried using the pointer this->
and :
Was not declared in this scope
I researched, but the doubts I found dealt with other aspects of functions friend
, moreover I was vehemently instructed not to carry out the implementation of such a function within my class. How can I accomplish this ?
A function marked as
friend
is not part of the class, it just means that the Friend function has access to class internals.– Mário Feroldi
In short : impossible to accomplish what I want ?! ( I think I will have to put the same in an external module to main )
– user48471
That sounds like the problem XY. Ask a question with what you really want to solve.
– Mário Feroldi