This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Optional parameter in derived classes
- From: Matthias Oltmanns <Mathias dot Oltmanns dot Oltmanns at sysde dot eads dot net>
- To: gcc-help at gcc dot gnu dot org
- Date: 05 Aug 2003 11:38:56 +0200
- Subject: Optional parameter in derived classes
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@sysde.eads.net