D
Dave
In Exceptional C++, the following code snippet appears at the bottom of page
197:
template<class T>
class Array : private ArrayBase, public Container
{
typedef Array AIType;
public:
Array( size_t startingSize = 10 )
: Container( startingSize ),
ArrayBase( Container::GetType() ),
After this code snippet, the following paragraph appears:
1. If GetType() is a static member function, or a member function that does
not use its this pointer (that is, uses no member data) and does not rely on
any side effects of construction (for example, static usage counts), then
this is merely poor style, but it will run correctly.
What am I missing here? Since when can a non-static member function ever be
called except through a concrete object? Container::GetType() is not a
valid call if GetType() is not static!!!! Surely I must be missing
something incredibly obvious here! Somebody, please set me straight!!!
197:
template<class T>
class Array : private ArrayBase, public Container
{
typedef Array AIType;
public:
Array( size_t startingSize = 10 )
: Container( startingSize ),
ArrayBase( Container::GetType() ),
After this code snippet, the following paragraph appears:
1. If GetType() is a static member function, or a member function that does
not use its this pointer (that is, uses no member data) and does not rely on
any side effects of construction (for example, static usage counts), then
this is merely poor style, but it will run correctly.
What am I missing here? Since when can a non-static member function ever be
called except through a concrete object? Container::GetType() is not a
valid call if GetType() is not static!!!! Surely I must be missing
something incredibly obvious here! Somebody, please set me straight!!!