Reorganizing code
-
Currently I have all these objects as a function / method "local " variables.
They can be used by other methods.Would it make for "better code" if I declare them as class variables and instantiate them all in the class constructor - and be done with it?
They can be used throughout the app, so they "go away" when the app exits.
// add common configuration
BT_Configuration_MainWindow *BTCMW = new BT_Configuration_MainWindow();
BTCMW->show();MainWindow\_Bluetoothctl \*MWB = new MainWindow\_Bluetoothctl(); MWB->show(); MWB->UpdateText(); BT\_Utility\_Library \*BTUL = new BT\_Utility\_Library();
-
Currently I have all these objects as a function / method "local " variables.
They can be used by other methods.Would it make for "better code" if I declare them as class variables and instantiate them all in the class constructor - and be done with it?
They can be used throughout the app, so they "go away" when the app exits.
// add common configuration
BT_Configuration_MainWindow *BTCMW = new BT_Configuration_MainWindow();
BTCMW->show();MainWindow\_Bluetoothctl \*MWB = new MainWindow\_Bluetoothctl(); MWB->show(); MWB->UpdateText(); BT\_Utility\_Library \*BTUL = new BT\_Utility\_Library();