Ie there is

file1.h void func1() { Class ob; ob.set(); } file2.h void func2() { Class ob2; //здесь необходимо присвоить значения объекта ob } 

Closed due to the fact that the question’s essence is not clear to the participants from Vlad from Moscow , αλεχολυτ , Alex , pavel , user194374 18 Dec '16 at 17:06 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

2 answers 2

no, ob is a local temporary object that will be deleted after func1 . Is it possible to make it global, or return from a function by value, like this

 //file1.h Class func1() { Class ob; ob.set(); return ob; } //file2.h void func2() { Class ob2 = func1(); } 

    Your ob object is not static, which means that it exists only during the function call func1 - so what values ​​(well, or to whom, because your comment allows such an interpretation) to assign? If this something does not exist at all at the moment?

    How could you have such a problem? Perhaps state the original problem - most likely, it is solved somehow otherwise ... It seems that your microscope is cracked :)