0

I'm using Xcode to compile the code. I think there should be a logical error but compiler doesn't raise any error.

Is it allowed to use member variable of passing argument class instance in defining class member function?

bool Foo::operator <(const Foo& f){
    if(dist < f.dist){
        return true;
    }
    else return false;
}

dist is a member variable and I don't really get why compiler allowed the function to use member variable of " f " instacne in defining member function of Class Foo.

AbdulAhmad Matin
  • 1,047
  • 1
  • 18
  • 27
hellomoon
  • 1
  • 2

0 Answers0