Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
33 lines (21 sloc) 629 Bytes
#include <iostream>
template<class Type>
class Other {
Type x;
Other(Type y){
x = y;
void first(const Other<int>& o) {/*One way of specifying the formal parameter*/
std::cout << o.x << '\n';
template<typename T> void second(const Other<T>& o) {/*Other way of specifyin formal parameter*/
/*Has to be decalred as templated function*/
std::cout << o.x << '\n';
int main(){
Other<int> other(123);/*initializing template class constructor*/
first(other);/*sending templated class as parameters*/
You can’t perform that action at this time.