I'm trying to call this function, just to get the contents to run:
template<class T>
void Pair<T>::display()
In my main function I'm trying to do:
display();
but that is not working. How can I run a template function from main?
You need create a object
of class Pair
to call function display()
. Like below:
void main(){
Pair<int> obj;
obj.display();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.