【发布时间】:2010-09-19 16:18:52
【问题描述】:
我正在尝试重写运算符
内部节点:
bool operator <(const Node* other) {
return *(this->GetData()) < *(other->GetData());
}
车内:
bool operator <(const Vehicle &other) {
return this->GetKilometersLeft() < other.GetKilometersLeft();
}
调用操作符:
while (index > 0 && m_heapVector[index] < m_heapVector[parent(index)])
向量定义:
vector<Node<T>*> m_heapVector;
我检查了调用,它没有调用被覆盖的运算符。
【问题讨论】:
标签: c++ templates operators overriding