Answer the question
In order to leave comments, you need to log in
How to use const object in different cpp files without copying (C++14)?
There is a base abstract class:
class spi_base {
public:
virtual int tx ( параметры ) const = 0;
virtual int rx ( параметры ) const = 0;
virtual ~spi_base() {}
};
template < параметры_шаблона >
class spi_master_hardware_os : public spi_base {
public:
constexpr spi_master_hardware_os ( void );
int reinit ( void ) const;
int tx ( параметры ) const;
private:
void on ( void ) const;
void off ( void ) const;
mutable bool handler_tx_point_inc_cfg_flag = false;
...некоторое_количество_mutable_переменных...
mutable uint32_t number_items = 0;
const spi_cfg< параметры_шаблона > cfg;
};
const spi_master_hardware_os< параметры_шаблона > spi1;
Answer the question
In order to leave comments, you need to log in
Here the question is when this object is created.
If no one uses main before the start of main(), and again before the start of main, then a simple extern is often enough .
If not quite so, then start "spudding" the singleton ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question