c++ - How does one use inheritance when we have a template class have template pointer -


Template pointer when there is a template class

We know that the base class pointers are easily generated The class can point to the object. I created another template class and crossed the base and got generated in it. However, I can not do even with an overloaded = operator, then my equal requirement is required.

Please take a look at this because it clearly explains the situation.

  #include & lt; Iostream & gt; using namespace std; Class base 1 {public: int a; Virtual Init Reset () {a = 0; Return; }}; Class 1: Public base 1 {public: int b; Int reset () {b = 0; Return b; }}; Template & lt; Class T & gt; Square templateclass {public: t * p; T & amp; Operator = (Template Class & amp; B) {this.p = reinterpret_cast & lt; T & gt; (BP); Return * This; } Zero Reset MySpace () {P-> Reset (); }}; Int main () {// Your code here template class & lt; Base1 & gt; * P = new template class & lt; Base1 & gt; (); TemplateClass & LT; Derived1 & gt; * Q = New template class & lt; Derived1 & gt; (); P = q; P-> ResetMyself (); Return 0; }   

When I compile my code, I

  prog.cpp: in the function "int main" () one: Prog.cpp: 44 : 3: Error: Template Class & lt; Derived1 & gt; * Â ???? Template class & lt; Base1 & gt; * One ???? Assignment in p = q; ^    

template class & lt; Derived1 & gt; and the template class & lt; Base 1 & gt; As is the case with int and double you can not specify pointers on another indicator.

You can call