// which is inturn NOT possible!
:)
// But THIS IS COMPILING
:)
// Does it NOT mean that creating an instance of Interface / abstract class??
The instance will be created implicitly, as a part of a
Der
-object.
Hence any member of
ISample/Base
would be counted to
sizeof(Der)
.
But yes, you are right,
it is inpossible to create an indifferent (without
diff()
) instance directly :)
PS: Something about interfaces:
An abstract interface will be used also to mask an object out:
void test(ISample* pISample)
{
if (pISample) {
pISample->HowAreYou();
}
}
class ISample
{
public:
virtual void HowAreYou() = 0;
};
#include "Sample.h"
class MaskedObj : public ISample
{
void SomeFunction();
public:
virtual void HowAreYou() { MyMessageBox("Fine, thank you!"); }
};
#include "client.h"
void MaskedObj::SomeFunction()
{
::test(this); }