Ваш вопрос немного расплывчат, но вот пример:
class foo
{
public:
foo()
{
vec.resize(100);
}
// normally would be operator[]
int& get(size_t pIndex)
{ // the return type is a reference. think of it as an alias
return vec[pIndex]; // now the return value is an alias to this value
}
private:
std::vector<int> vec;
};
foo f;
f.get(10) = 5;
// f.get(10) returned an alias to f.vec[10], so this is equivalent to
// f.vec[10] = 5
В FAQ есть хороший раздел с ссылками .
Кроме того, если вы новичок в C ++, не пытайтесь учиться с онлайн-ресурсами. Если у вас нет книги, , вам следует , это действительно единственный хороший способ выучить язык.