#include <iostream>  
    using namespace std;  
    template<class T>  
    class A   
    {  
        public:  
        T num1;  
        T num2;  
       void getdata(T a,T b)
        {
            num1=a;
            num2=b;
       }
        void add()  
        {  
            cout << "Addition of num1 and num2 : " << num1+num2<<std::endl;  
        }  
          
    };  
      
    int main()  
    {  
        A<int> d;  
        d.getdata(10,20);
        d.add();  
        return 0;  
    }  

     
           
Note: Need to be arranged in compiler after copied
   

 OutPut:

Addition of num1 and num2 : 30