Ie there is
file1.h void func1() { Class ob; ob.set(); } file2.h void func2() { Class ob2; //здесь необходимо присвоить значения объекта ob } Ie there is
file1.h void func1() { Class ob; ob.set(); } file2.h void func2() { Class ob2; //здесь необходимо присвоить значения объекта ob } 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 .
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 :)
Source: https://ru.stackoverflow.com/questions/604602/
All Articles