내가 알고 싶은 그러한 방법 작성하지 않는 경우 C++로 명명 규칙 "널리 인정"더로 ( 매개 변수를 수정하거나 새 인스턴스를 반환하는 메서드/함수에 대한 C++ 이름 지정 규칙? 이 있는지
class Transform3d {
public:
// Apply rotation using a copy of toRotate and return it
Vector3d ApplyRotation(const Vector3d& toRotate) const;
// Apply rotation directly to toRotate
void ApplyRotationInPlace(Vector3d& toRotate) const;
// Apply rotation on this Transform3d instance (orientation quat)
void ApplyRotation(const Vector3d& toRotate);
//...
// Apply transformation using a copy of toTransform and return it
Transform3d ApplyTransform(const Vector3d& toTransform) const;
// Apply transformation directly to toTransform
void ApplyTransformInPlace(Vector3d& toTransform) const;
private:
Quaternion orientation;
Vector3d position;
};
매개 변수의 수정 및 새로운 인스턴스를 반환 다루는 ++ 방법 C를 작성하기위한 몇 가지 지침 거기를 매개 변수 수정)?
일부 주안점은 ** Transform3d **는 변경 불가능한 클래스 여야한다고 주장 할 수도 있습니다. –
서명에서 'ApplyTransformInPlace'는 비 const 참조를 취하고'void '를 반환하므로'toTransform '을 수정한다는 것은 명백합니다. 여분의 말씨는 혼란 스럽다. –
함수 이름에서'Apply'를 삭제하십시오. 아무 것도 추가하지 않습니다. 'rotate'와'transform'은 메시지를 전달합니다. –