Path: utzoo!utgpu!news-server.csri.toronto.edu!eecg.toronto.edu!zq Newsgroups: comp.lang.c++ From: zq@eecg.toronto.edu (Qing Zheng) Subject: Question for C++ expert Message-ID: <1991Jan28.223456.465@jarvis.csri.toronto.edu> Distribution: comp Date: 29 Jan 91 03:34:56 GMT Lines: 35 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