Witam mam dziwny problem chce by zmienna którą podaj użytkownik w klasie która rysuje menu była widoczna w innej klasie w której robię pewne działania. Po części mi to działa ale dopiero jak wpiszę tę zmienną drugi raz to mi pokarze kkk.get_choice().
main.cpp

#include "open_file.h"
#include "get_system_clock.h"
#include "menu_choice.h"
#include "transaction.h"
#include <iostream>
#include <fstream>
#include <chrono>
#include <ctime>

int main()
{
    using std::chrono::system_clock;

    Open_file my_file;
    std::cout << "to jest budzet: " << my_file.get_budget() << std::endl;
    std::cout << "to jest ssm: " << my_file.get_smart_saver_mateusz() << std::endl;
    std::cout << "to jest ssj: " << my_file.get_smart_saver_justyna() << std::endl;

    Get_system_clock time_now;

    Menu_choice menu;

    transaction kkk;
    std::cout << "to jest zmienna choice ale w innej klasie: " << kkk.get_choice() << std::endl;

    return 0;
}

menu_choice.h

#ifndef MENU_CHOICE_H
#define MENU_CHOICE_H


class Menu_choice
{
private:
public:
    Menu_choice();
    int choice = 0;
};

#endif // MENU_CHOICE_H
 

menu_choice.cpp

#include "menu_choice.h"
#include <iostream>
#include <limits>

Menu_choice::Menu_choice()
{

    std::cout << "====================================================" << std::endl;
    std::cout << "=====Wybierz jedna z opcji ktora Cie interesuje=====" << std::endl;
    std::cout << "================1)Platnosc gotowka: ================" << std::endl;
    std::cout << "=================2)Platnosc karta: =================" << std::endl;
    std::cout << "=================3)Wplata na konto: ================" << std::endl;
    std::cout << "========4)Pokaz dostepne sierodki z budzetu: =======" << std::endl;
    std::cout << "==5)Pokaz wszystkie transakcje z danego miesiaca: ==" << std::endl;
    std::cout << "====================================================" << std::endl;

    std::cin >> choice;
    std::cout << "to jest choice: " << choice << std::endl;

}

 

transaction.h

 #ifndef TRANSACTION_H
#define TRANSACTION_H

#include "menu_choice.h"


class transaction: public Menu_choice
{
public:
    transaction();
    inline int get_choice() {return choice;}

};

#endif // TRANSACTION_H

transaction.cpp

#include "transaction.h"
#include "menu_choice.h"
#include <iostream>

transaction::transaction()
{
}