help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compilation difference between VC++ and G++


From: Thomas Maeder
Subject: Re: Compilation difference between VC++ and G++
Date: Fri, 09 Jun 2006 17:56:38 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

smsabu2002@yahoo.com 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]