Note that there are some explanatory texts on larger screens.

plurals
  1. POno matching function call to a constructor
    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()=0; }; class name { private: string fname; string lname; public: name(string first, string last); // bool operator== (name &amp; p1, name &amp;p2) }; name::name(string first, string 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 temp(first,last); people&lt;name&gt;* aPerson = new person&lt;name&gt;(); aPerson-&gt; insert(temp); cout &lt;&lt; aPerson-&gt;show() &lt;&lt; endl; return 0; } </code></pre> <p>These are the errors I'm getting:</p> <pre class="lang-none prettyprint-override"><code>test.cpp: In function 'int main()': test.cpp:53: error: no match for 'operator&lt;&lt;' in 'std::cout &lt;&lt; people&lt;T&gt;::show [with T = name]()' test.cpp: In constructor 'person&lt;T&gt;::person() [with T = name]': test.cpp:51: instantiated from here test.cpp:37: error: no matching function for call to 'name::name()' test.cpp:21: note: candidates are: name::name(std::string, std::string) test.cpp:12: note: name::name(const name&amp;) </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.
 

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