Note that there are some explanatory texts on larger screens.

plurals
  1. POc++ type/value mismatch at argument 1 in template parameter list
    primarykey
    data
    text
    <pre><code>#include &lt;iostream&gt; using namespace std; template&lt;class T&gt; class people{ public: virtual void insert(T item)=0; virtual T show(T info)=0; }; template&lt;class T&gt; class name { private: T fname; T lname; public: name(T first, T last); // bool operator== (name &amp; p1, name &amp;p2) }; template &lt;class T&gt; name&lt;T&gt;::name(T first, T last){ fname = first; lname = last; } template &lt;class T&gt; class person : public people&lt;T&gt; { private: T a[1]; int size; public: person(); virtual void insert(T info); virtual T show(); }; template&lt;class T&gt; person&lt;T&gt;::person(){ size = 0; } template&lt;class T&gt; void person&lt;T&gt;::insert(T info){ a[0] =info; } template&lt;class T&gt; T person&lt;T&gt;::show(){ return a[0]; } int main(){ string first("Julia"), last("Robert"); name&lt;string&gt; temp(first,last); people&lt;name&gt;* aPerson = new person(); aPerson-&gt; insert(temp); aPerson-&gt;show(); return 0; } </code></pre> <p>These are the errors I keep getting and I can't pinpoint what really is the problem:</p> <pre class="lang-none prettyprint-override"><code>test.cpp:52: error: type/value mismatch at argument 1 in template parameter list for 'template&lt;class T&gt; class people' test.cpp:52: error: expected a type, got 'name' test.cpp:52: error: invalid type in declaration before '=' token test.cpp:52: error: expected type-specifier before 'person' test.cpp:52: error: expected ',' or ';' before 'person' test.cpp:53: error: request for member 'insert' in '* aPerson', which is of non-class type 'int' test.cpp:54: error: request for member 'show' in '* aPerson', which is of non-class type 'int' </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload