Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!ira.uka.de!smurf!nadia!ananke!kaiser From: kaiser@ananke.stgt.sub.org (Andreas Kaiser) Newsgroups: comp.lang.c++ Subject: different member functions with same arg types? Message-ID: <76.279B57DF@ananke.stgt.sub.org> Date: 21 Jan 91 21:05:25 GMT Organization: Subnet-Fidonet Gateway, Stuttgart, FRG Lines: 28 In a message of , Skip Montanaro (montnaro@spyder.crd.ge.com ) writes: SM> class parser : public ... SM> { SM> ... SM> public: SM> parse(char *string); SM> parse(char *filename); SM> ... SM> } SM> Unfortunately, both strings and filenames are char *'s, so the compiler SM> can't distinguish the two interfaces. Is it kosher to add a dummy argument SM> to one member function? It seems crude to me: How about parse_string(char *); parse_file(char *); ? Dummy members are of course possible although ugly, but I don't see any reason, why you don't whant to use different names for this purpose. It makes the code better readable. It is not only the compiler which might get into trouble, deciding which function you really want to call. Andreas