Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9145269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:28:23+00:00 2026-06-17T10:28:23+00:00

What is the current syntax for writing a template member class parameter inside a

  • 0

What is the current syntax for writing a template member class parameter inside a template class.

This is what I been trying to do:

template <class T>
    class Node
    {
    public:
        Node(); // constructor 
        Node(const Node<T> &);           // copy constructor 
        ~Node();             // destructor
        T value;
        Node *next;
    };


template <class T> 
class Linked_list
{
public:
    Linked_list(); // constructor 
    Linked_list(const Linked_list<T> &); // copy constructor 
    ~Linked_list();             // destructor
    T pop();
    void push(T value);
    T top();
    bool is_empty();
    void clear();

private:
    Node<T> *head; // COMPILER ERROR
};

Why this is a compiler error?

Node<T> *head; // COMPILER ERROR
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T10:28:24+00:00Added an answer on June 17, 2026 at 10:28 am

    Perhaps when you call:

    Node<T> *head;
    

    T is not an object type, and it doesn’t know how to construct that. Try:

    Node<std::string> *head;
    

    or something like that. T is not an object type, it is just like a variable name, except it is actually a variable type within the class Node and LinkedList.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to require_once a file in a document; here's my current syntax: $path
Error: Syntax error on token setDefaultCloseOperation, Identifier expected after this token Current Code: package
i store some information in my website (mvc3-.net4-iis7) by this syntax: HttpContext.Current.Application.Add(appKey, value); and
My current implementation uses lots of copy constructors with this syntax MyClass::Myclass(Myclass* my_class) Is
After discovering on superuser that there is no current way to add syntax highlighting
i am wondering if the basic link_to syntax is completely broken in current rails3
I'm writing SkipList implementation in a STD-like way: using allocators, iterators, etc. Whole class
I'm writing a sidebar for my site and I'm trying to check if: The
How can I adjust my current .hgingore syntax: glob oes images *.bak So that
This is a quick syntax question... I need to block out an HTML element

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.