[net.lang.c++] constructor declaration

byee@g.cs.cmu.edu (Bennet Yee) (07/24/86)

I've started playing with C++ & wrote the following:

class hashtable {
	queue_t	bucket[HASHSIZE];
	int	(*hash_f)(char *);
public:
	hashtable(int (*hf)(char *)) { hash_f = hf; }
	...
}

but the compiler complains with syntax error at the declaration
for the constructor (3 lines), and also then complains something
about hf, type expected.  What did I do wrong, O c++ wizards?

-Bsy

mat@mtx5a.UUCP (m.terribile) (07/30/86)

> I've started playing with C++ & wrote the following:
> 
> class hashtable {
> 	queue_t	bucket[HASHSIZE];
> 	int	(*hash_f)(char *);
> public:
> 	hashtable(int (*hf)(char *)) { hash_f = hf; }
> 	...
> }
> 
> but the compiler complains with syntax error at the declaration
> for the constructor (3 lines), and also then complains something
> about hf, type expected.  What did I do wrong, O c++ wizards?
> 
> -Bsy

Well, for one thing, inline function definitions must be followed by
a semicolon.  This is one that your fingers will take a while to get
used to!
-- 

	from Mole End			Mark Terribile
		(scrape .. dig )	mtx5b!mat
					(Please mail to mtx5b!mat, NOT mtx5a!
						mat, or to mtx5a!mtx5b!mat)
					(mtx5b!mole-end!mat will also reach me)
    ,..      .,,       ,,,   ..,***_*.