[comp.lang.c++] Question for C++ expert

zq@eecg.toronto.edu (Qing Zheng) (01/29/91)

  If I have the following classes

clase Data {
	....
};

class A {
private:
	Data	buf[10];
public:
	const Data& operator[](int subscript) const
	{	return buf[subscript];		}
	...
};

  The question is I would like to have a full read access to the buf[], and
I also want to have write access to buf[5-9] using operator=. e.g.

	Data val;
	A    a;
        ....
	a[i] = a[j] + val; // 0 <= j <= 9; 5 <= i <= 9, OK
			   	       // however, if 0 <= i < 5, print out error message

  Is it possible ? How can I do that ?


  Thanks in advance. please send mail to zq@eecg.toronto.edu

  ---Qing