Hi, im writing a library and I need a bit write function for inside the library. I must have a 8 bit a 16 bit and a 32 bit function, so I thought of Polymorphism.

This are the functions I came with:

```
uint8_t DebouncedEdgeDetector_16Bit::BitWrite(uint8_t Var, uint8_t Bit, bool Data)
{
uint8_t bitmask = ~(1 << Bit);
uint8_t data = Data << Bit;
Var = (Var & bitmask) | data;
return Var;
}
uint16_t DebouncedEdgeDetector_16Bit::BitWrite(uint16_t Var, uint8_t Bit, bool Data)
{
uint16_t bitmask = ~(1 << Bit);
uint16_t data = Data << Bit;
Var = (Var & bitmask) | data;
return Var;
}
uint32_t DebouncedEdgeDetector_16Bit::BitWrite(uint32_t Var, uint8_t Bit, bool Data)
{
uint32_t bitmask = (1 << Bit);
uint32_t data = Data << Bit;
Var = (Var & bitmask) | data;
return Var;
}
```

The thing is that I’m now trying to use the 32 bit write, but it always returns 0

can someone help me with this??

thanks!

Edit: I just realized that I didn’t posted this in programming questions… Sorry