Code: cpp
class Base
{
  public:
  virtual void F(int a = 10)
  {
     cout<<"Base : "<<a<<endl;
  }
};

  class Derived: public Base
  {
  public:
  void F(int b = 20)
  {
       cout<<"Derived : "<<b<<endl;
  }                       
};

void main()
{
    Base* b = new Derived;
    b->F(2);
}
When I run this program in defferent plateform It's behaviour is defferent...

On Visual Studion 2005
Output is Derived : 10
On g++ and Sun Solaris
Output is Derived : 2

I got One reason for Effective C++ Item no 23 like this

"The function is overridden and will call the derived class function but the default value is statically bound and will take the default value of base class That being the case, the justification for this Item becomes quite straightforward: virtual functions are dynamically bound, but default parameter values are statically bound."
" Never redefine an inherited default parameter value, because default parameter values are statically bound, while virtual functions � the only functions you should be overriding � are dynamically bound. "

If It is true then Why g++ is not supporting ??? Can You give me reason???