Replace NonCopyable in CAN inheritance.

This commit moves the deletion of copy constructor and copy assignment operators to the `mbed::interface::can` class, where both `mbed::CAN` and `mbed::interface::CAN` inherit enum types from. This allows `NonCopyable` to be removed from the inheritance list.
pull/14336/head
George Beckstein 2021-05-07 21:02:34 -04:00
parent d79446c0da
commit d39a4168ec
2 changed files with 8 additions and 5 deletions

View File

@ -25,7 +25,6 @@
#include "hal/can_api.h"
#include "platform/Callback.h"
#include "platform/PlatformMutex.h"
#include "platform/NonCopyable.h"
namespace mbed {
@ -39,9 +38,9 @@ namespace mbed {
*/
class CAN
#ifdef FEATURE_EXPERIMENTAL_API
final : public interface::CAN, private NonCopyable<CAN>
final : public interface::CAN
#else
: private NonCopyable<CAN>, public interface::can
: public interface::can
#endif
{

View File

@ -145,8 +145,12 @@ struct can {
protected:
can() = default;
~can() = default;
can(const can &) = default;
can &operator=(const can &) = default;
public:
/* Copy constructor and copy assignment operators will be deleted in subclasses as well */
can(const can &) = delete;
can &operator=(const can &) = delete;
};