templates - c++: Passing objects to functions -


i going through code encountered problem , able crack piece of code:

#include <iostream> #include <stdint.h> #include <unistd.h> #include <errno.h> #include <vector> #include <sys/types.h>  using namespace std;  class abc {   public:     abc(int x,int y) {       cout << "x:" << x << endl;       cout << "y:" << y << endl;     }      virtual ~abc() {}      enum example {       = 1,       b = 2,       c = 3,       d = 4     }; };  template<typename t> class xyz {   public:     void some_func(abc *a) {       cout<<"some_func called"<<endl;     } };  int main() {} 

i want call function

some_func() 

from main(). how should that. can me this??

you need create object of specialization of template class xyz , object of type abc.

for example

int main() {    abc a( 10, 20 );     xyz<int> x;     x.some_func( &a ); } 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -