Optional parameter in derived classes

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

 



Hi all,

i've learned that it is not neccessary to have the same default values
(or any default value at all) by overriding methods.
That means the following is legal:

class Base {
public:
  virtual void foo(int param = 0) = 0;
};

class A : public Base {
public:
  void foo(int param);
};

class B : public Base {
public:
  void foo(int param = 4711);
};

I had expected that one *MUST* use the same default values while
overriding methods with optional parameters.
Is there any warning switch which gives me a hint, that i'm overriding a
method with optional parameters in a different manner?

Thanks and greetings
Matthias Oltmanns

-- 
Matthias Oltmanns

Tel: 04421-1543-274
mail: Mathias.Oltmanns.Oltmanns@xxxxxxxxxxxxxx


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux