operator [] method

double operator [](
  1. int addr
)

Implementation

double operator [](int addr){
  if(addr == 0){
    return x;
  }
  else if(addr == 1){
    return y;
  }
  else if(addr == 2){
    return z;
  }
  else{
    throw('Value can not be bigger than 2 nd less than 0');
  }
}