This is most probably more of a C++ question than an Arduino question; but since this is an Arduino library, I am asking here.
I am using the SdFat library for my project. The library defines a BlockDriver
object in one of its header file which only declares the typedef
of BaseDriver
to some other classes.
#if ENABLE_EXTENDED_TRANSFER_CLASS || ENABLE_SDIO_CLASS
typedef BaseBlockDriver BlockDriver;
#else // ENABLE_EXTENDED_TRANSFER_CLASS || ENABLE_SDIO_CLASS
typedef SdSpiCard BlockDriver;
#endif // ENABLE_EXTENDED_TRANSFER_CLASS || ENABLE_SDIO_CLASS
#endif // BlockDriver_h
typedef SdSpiCard BlockDriver;
makes sense to me. But if ENABLE_EXTENDED_TRANSFER_CLASS
or ENABLE_SDIO_CLASS
are defined, BlockDriver
is typedeffed into BaseBlockDriver
. BaseBlockDriver
is an abstract base class (as defined here). An instance of the BlockDriver
object is later used directly in the FatVolume
class here.
My question is, how does BlockDriver
's method get defined when it abstract base class BaseBlockDriver
is typedeffed to BlockDriver
?
BlockDriver
is aBaseBlockDriver
. Hope that clarified my confusion.