[EMAIL PROTECTED] writes:

> I try to call a function implemented in the Baseclass from the
> DerivedClass.
>
> When i compiled it using VC++, the following Error was thrown
> "illegal Call to non-static member BaseClass::function() "
> But, it gets compiled with  g++ in Solaris.
>
> What could be the problem.

Several compiler bugs. What version of g++ are you using?


> ================
> class BaseClass
> {
>     void function() { cout<<"Inside Base Class"<<endl; } }

cout and endl are undeclared. There should be a semicolon here ...


> class DerivedClass : public::BaseClass
> {
>     void function();
> }

... and another one here.


> DerivedClass::function()
>
> {
>     cout<<"Inside Derived Class"<<endl;
>      BaseClass::function();

If you fix all of the above, the only compiler error remaining should
be that BaseClass::function isn't accessible from this point.
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to