Skip to content

Commit 072a15e

Browse files
committed
copy construct; assignment operator
1 parent 15b6ce0 commit 072a15e

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/sfeTkArdI2C.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@ class sfeTkArdI2C : public sfeTkII2C
4747
{
4848
}
4949

50+
// copy constructor
51+
sfeTkArdI2C(sfeTkArdI2C const &rhs) : _i2cPort{rhs._i2cPort}
52+
{
53+
}
54+
55+
// Copy assignment
56+
sfeTkArdI2C &operator=(const sfeTkArdI2C &rhs)
57+
{
58+
_i2cPort = rhs._i2cPort;
59+
return *this;
60+
}
61+
5062
/// @brief Method sets up the required I2C settings.
5163
/// @note This function provides a default I2C Port.
5264
///

src/sfeTkArdSPI.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ class sfeTkBusSPI : public sfeTkIBus
3939
///
4040
sfeTkBusSPI(void) : _spiPort(nullptr){};
4141

42+
// copy constructor
43+
sfeTkArdSPI(sfeTkArdSPI const &rhs) : _spiPort{rhs._spiPort}, _sfeSPISettings{rhs._sfeSPISettings}
44+
{
45+
}
46+
47+
// Copy assignment
48+
sfeTkArdSPI &operator=(const sfeTkArdSPI &rhs)
49+
{
50+
_spiPort = rhs._spiPort;
51+
_sfeSPISettings = rhs._sfeSPISettings;
52+
return *this;
53+
}
4254
/// @brief Method sets up the required SPI settings.
4355
/// @note This function provides a default SPI Port.
4456
///

0 commit comments

Comments
 (0)