Aug 28, 2012 at 6:37pm
Try passing the object to the print function:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
template <class T2>
void print(test<T2> temp) //define temp as argument here
{
cout<<"\nval1 = "<<temp.val1;
cout<<"\nval2 = "<<temp.val2;
}
//...
int main()
{
double x,y;
cout<<"Enter a number: ";
cin>>x;
cout<<"Enter another number: ";
cin>>y;
test<double> obj1(x,y);
print<double>(obj1); //pass it here
obj1.lowest();
cin.ignore();
cin.get();
}
|
Hope that helps.
All the best,
NwN
Last edited on Aug 28, 2012 at 6:37pm
Aug 28, 2012 at 6:45pm
Thank you all. It's working perfectly!!!