Mismatched Signatures???

Hi,

1
2
3
4
5
6
7
8
9
10
11
class Foo
{
public:
	virtual void baz(void*) = 0;

};
class Bar : public Foo
{
public:
	void baz(Qux*); 
};


I have the feeling this isn't going to work the way I intended.
Last edited on
https://en.wikipedia.org/wiki/Liskov_substitution_principle
Preconditions cannot be strengthened in a subtype.
Good answer.

https://en.wikipedia.org/wiki/Precondition

In the presence of inheritance, the routines inherited by descendant classes (subclasses) do so with their preconditions in force. This means that any implementations or redefinitions of inherited routines also have to be written to comply with their inherited contract. Preconditions can be modified in redefined routines, but they may only be weakened.[2] That is, the redefined routine may lessen the obligation of the client, but not increase it.


Topic archived. No new replies allowed.