M
Maluk
I was wondering why something like this is allowed by the standard.
--- code ---
// Implementation ommitted.
class Base
{
public:
virtual void someFunction ( void ) ;
}
class Derived
{
private:
void someFunction ( void ) ;
}
int main ( void )
{
Derived d ;
Base* pb ;
pb = &d ;
pb->someFunction( ) ; // This calls Derived :: someFunction( )!
}
Now, Derived's private function is made available to the world through a
pointer to the base!
--- code ---
// Implementation ommitted.
class Base
{
public:
virtual void someFunction ( void ) ;
}
class Derived
{
private:
void someFunction ( void ) ;
}
int main ( void )
{
Derived d ;
Base* pb ;
pb = &d ;
pb->someFunction( ) ; // This calls Derived :: someFunction( )!
}
Now, Derived's private function is made available to the world through a
pointer to the base!