Base Class Accessible Accessible As Type Via Derived Class
Hi All,
I am trying to locate the specific documentation in TCPPPL 3rd Ed.
that says that a class is a scope, and applying the scope resolution
operator allows access to types from that scope.
Consider:
template <class Element>
struct Base
{
Element element;
} ;
struct Derived : public Base<int>
{
Base b1; // <int> unnecessary
Base b2; // <int> unnecessary
} ;
First, I can no longer find the page that says that specification
of <int> is unnecessary, as there is no ambiguity in type of Base.
Furthermore:
struct Big
{
int i;
} ;
struct Bigger : public Big
{
int j;
} ;
int main ()
{
Derived::Base<int>; // OK, <int> unnecessary
Derived::Base; // OK, <int> unnecessary
Derived::Base<float>; // error
Derived::Base b3; // OK, Base is accessible via Derived
Bigger::Big k; // OK, Big is accessible via Derived
return 0;
}
We see that base classes are types that are usable external to the
scope of the derived class. Where in TCPPPL 3rd edition does
it say this?
TIA,
-Le Chaud Lapin-
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]