Contollerという名前のクラスがあります。そのクラスから 1 つのオブジェクトを作成し、実行時に transactionValue と transactionId を何度も変更したいと考えています。そのための最良の方法は何ですか。デフォルトのコンストラクターから 1 つのオブジェクトを作成し、setControllerValues を新しい値に使用できると思います。それはベストプラクティスですか?
class Controller{
public:
    Controller();
    Controller(int,int);
    setControllerValues(int,int);
private:
    int transactionValue;
    int transactionId;
};
int main()
{
    Controller ct;
    ct.setControllerValues(3,4);
    ct.setControllerValues(6,7);
    ct.setControllerValues(34,45);
}
EDIT:シングルトンについて聞いたことがあります。そのために使用する必要がありますか?(「スケルトン」に変更しました)