Hello.
Here is a description of the class. (Stores name and age)
class Military { private: AnsiString FIO; int Age; public: Military(AnsiString FIOName, int MA):FIO(FIOName),Age(MA){}; Military(){}; ~Military(){}; int get_Age(){return Age;}; void set_Age(int MA){Age=MA;}; I create the Military М1; class Military М1;
I set the age of M1.set_Age(int MA) in the form Form1
However, when trying to call ShowMessage(M1.get _Age()); (getting the value of MA) in the form Form2 , zero is output, i.e. The value of the Age variable of the Military class is reset, although when you call ShowMessage(M1.get _Age()); Form1 displays exactly the value that I assigned to MA and indicated in M1.set_Age(int MA) .
The question is how to correct this error so that it is possible to get the class values in the query from any form?