0

我在头文件中有以下内容。具有许多功能的模板类。

#pragma once
#include <string>
using namespace std;    

template <class T>
class Vector3Generic
{
public:
    T x;
    T y;
    T z;

    Vector3Generic();
    ~Vector3Generic();
    Vector3Generic(T vx, T vy, T vz);
    Vector3Generic(Vector3Generic& v);
    // 
    // ... many functions, some static, and some are not.
    static T Vector3Generic::Distance(const Vector3Generic& a, const Vector3Generic& b);
    static T Vector3Generic::Slope(const Vector3Generic& linepoint1, const Vector3Generic& linepoint2);

};      
template <class T>
T Vector3Generic<T>::Distance(const Vector3Generic<T>& a, const Vector3Generic<T>& b)
{
    auto vector = Vector3Generic<T>(a.x - b.x, a.y - b.y, a.z - b.z);
    return sqrt(((vector.x * vector.x) + (vector.y * vector.y)) + (vector.z * vector.z));
}
template <class T>
T Vector3Generic<T>::Slope(const Vector3Generic<T>& linepoint1, const Vector3Generic<T>& linepoint2)
{
    return (linepoint2.z - linepoint1.z) / (linepoint2.x - linepoint1.x);
}

我的问题是我只收到上面包含的函数的错误消息。我无法弄清楚问题所在。

你能看出有什么问题吗?

4

0 回答 0