我们的讲师要求我们浏览一个模板并解释它的各个部分在做什么:
Template<class T> set<T> set<T>:: setDifference(const Set<T> &that) const
这是我到目前为止所得到的:
Template<class T>: declares the new template
set<T>: states the return type of our template
set<T>: pretty confused about the second set, possibly the class name?
setDifference: Calls on our setDifference function
const Set<T> &that:
Parameters of setDifference, states set<T> cannot be modified within
setDifference or put on the left hand side of the equation. "&that" references "that"
memory location to use/call
const (at the end):
Our function can only be called by a const object of the class
nor can it call any non-const member functions or change member variables.
如果有人可以请更正/添加到我已经拥有的内容,我将不胜感激。