c++ - Mixing abstract class inheritance with instantiated templates -


OK, I know - due to complexity-virtual template methods are not allowed.

However, keeping this in mind:

  // something.h class absClass {public: // ... // Instead of changing the application class fun method Define different // overloads can be used: Virtual Zero Fun (class A) = 0; Virtual Zero Fun (Class Bb) = 0; }; Class Impulse: Public Esp class {public: // ... template & lt; Typename T & gt; Zero Funny (tt) {/ * Whatever} // Declaration is Zero Funny (Class A); Zero Fun (Class Bb); };  

And then we set the specific acceleration of the method in the module?

  // something.cpp #include "something.h" // instantaneous zero zero :: funny & lt; Class A & gt; (Class A); Zero Freedom :: Funny & lt; ClassB & gt; (ClassB t);  

Is not it going to work? I am getting errors (irrespective of whether they have. Or CPP).

  // ---- something.h class absclass {public: // // Instead of changing the method of the application class, define different // overloads that are being used: Virtual Zero Fun (class AA) = 0; Virtual Zero Fun (Class Bb) = 0; }; Class Impulse: Public Esp class {public: // ... template & lt; Typename T & gt; Zero Funny (Tt) {/ * Whatever * / # 1} // Announcement Zero Funny (Class A) {// # 2 - Implementation of Base Class Pure Virtual Function // Note: You should define this function, Otherwise the linker is error} zero fun (class B b) {}}; // ---- some.cpp #include "something.h" // instant template void impClass :: funny & lt; Class A & gt; (ClassA t); // missing "template" template void impClass :: Funny & lt; ClassB & gt; (ClassB t); // Apply missing "template" // ---- main.cpp o; Class AA; O.fun & lt; ClassA & gt; (A); // call # 1 o.fun (A); // call # 2  

Since you have void impClass :: fun & lt; ClassA & gt; (ClassA t) are writing; Then you're specializing, so you should see the template & lt; & Gt; Do this before.

But this is not the function body for the implementation of your virtual function, these are other things ... check 2 different calls provided to me. Comment based on # 1:

Okay, there is still a thing for specificity, if you want to achieve something special for a specific class, is not it?

By the way, what do you mean immediately? Are you trying to export a class template?

Comment based on # 2:

Do you want to?

  class pr: public asp class {public: template  

or:

  template & lt; Typename T & gt; Void so_fun (TT) {/ * which defines the general behavior here * / / * defines the class population: Public Esplus {public: zero fun (class A) {so_fun (A); } Zero Funny (Class Bb) {so_fun (B); }};  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -