[comp.lang.c++] Virtual function problem. and apology

mcf@trlamct.trl.oz.au (Michael Flower) (05/10/91)

In article mcf@tardis.trl.OZ.AU (Michael Flower) I wrote:
 
The code

class A {
	virtual void	fn(char);	// 1
	virtual void	fn(char *);	// 2
};
class B : public A {
	void	fn(int);
};

produces the error
 
"t.c", line 7: warning:  B::fn() hides virtual A::fn()
"t.c", line 7: warning:  B::fn() hides virtual A::fn()

Well, in fact it does, but the real problem I have is slightly different.

I am guilty of making a mistake in my posting, and not checking it thoroughly.
class B should read


	class B : public A {
		void fn(char *);
	}

NB. I really was trying to redefine A::fn().


Thank you for your previous replies however, I have learned quite a lot
from mistaken problem, which has really some quite interesting properties.
I will have to give more thought to parameter conversions, along with the
replies I got, I should really learn something here.

The problem I had was that I was really trying to redefine A::fn(char*), and
the warnings I got made me suspicious that I hadn't really managed it.
Eventually when I tried changing lines 1 and 2 in class A,
the problem went away.
Michael Flower
Artificial Intelligence Systems         Email:     m.flower@trl.oz.au
Telecom Research Laboratories           Voice:     +61 3 541 6179
Melbourne, AUSTRALIA                    Fax:       +61 3 543 8863