[comp.lang.c++] easy question

robert@ireq.hydro.qc.ca (R.Meunier 8516) (03/09/91)

	I have 2 easy question on c++


======================================================================
1) How can i declare two object that point to each other?



class A
{
private:
	B	*b;
public:
	...
}

class B
{
private:
	A	*a;
public:
	...
}

	Of course, the compiler give an error on this because when compiling
A, B is undefined.




======================================================================
2) How do i declare a parameter that i do not use to avoid a warning
   from the compiler



void func(int a, int b)
{
int c;

	c = a;
}

	b is not use and i do not wan't to use it but the compiler gives me
a warning.



--
Robert Meunier                     Institut de Recherche d'Hydro-Quebec
Ingenieur                          1800 Montee Ste-Julie, Varennes
Internet: robert@ireq.hydro.qc.ca  Qc, Canada, J3X 1S1 
maintainer: BASIC mailing list request to basic-request@ireq.hydro.qc.ca

ark@alice.att.com (Andrew Koenig) (03/09/91)

In article <5914@s3.ireq.hydro.qc.ca> robert@ireq.hydro.qc.ca () writes:

> 1) How can i declare two object that point to each other?

	class A;	// optional
	class B;	// not optional

	class A { B* b; };
	class B { A* a; };

> 2) How do i declare a parameter that i do not use to avoid a warning
>    from the compiler

	void func(int a, int)
	{
		int c;

		c = a;
	}
-- 
				--Andrew Koenig
				  ark@europa.att.com