Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有模板方法,我希望模板方法使用类中的特定方法来执行操作。是否可以 ?
template<typename T> int minus(T t1,T t2){ return t1-t2; }
在我的苹果对象类中,我有一个名为 getPrice() 的方法,我如何将两者结合起来。
它是否正确 ?
template<typename T> int minus(T t1,T t2){ return t1.getPrice()-t2.getPrice(); }
为此,您可能需要为您的类型提供一个普通函数:
template <class T> int minus(T t1, T t2) { return t1 - t2; } int minus(const apple& t1, const apple& t2) { return t1.getPrice() - t2.getPrice(); }
如您所知,在某些情况下,制作包含大量边框的布局(即:某种打印填写表单)可能会非常痛苦。table那么,WCAG 2.0 中使用vsdivs用于布局目的是可以接受/正确的行在哪里?
table
divs