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

  • SEARCH
  • Home
  • 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 9251449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:42:05+00:00 2026-06-18T10:42:05+00:00

template<class T> class CRevList { public: //…constructor, destructor, etc; class Node //nested class {

  • 0
template<class T> class CRevList
{
public:
//...constructor, destructor, etc;
  class Node //nested class   
  {
  public:
   friend class CRevList;

    Node() {m_next = 0;  m_prev = 0;}
    Node(const T &t) {m_payload = t;  m_next = 0;  m_prev = 0;}

    T Data() {return m_payload;}
    const T Data() const {return m_payload;}

    private:

      Node    *m_next;
      Node    *m_prev;
      T       m_payload;
  };
private: //for original class
  Node    *m_head, *m_tail;             // Head node
  unsigned size;
};

I’ve made many attempts to get the payload of the nodes from original doubly linked class unfortunately I get errors. most like:

       error: request for member 'Data' in 'Temp1', which is of non-class type 'CRevList<int>::Node*'

I must be messing something up with pointers or relationships between the two classes.

I’ve tried:

  //Find a node with the specified key
  const Node *Find(const T &t) const {  }
  Node *Find(const T &t) {
    Node * Temp1 = m_head;

    while(m_tail != Temp1){
            if(Temp1.Data() == t){
                    return Temp1;
            }

            Temp1 = Temp1->m_next;
    }
  }
  • 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-18T10:42:06+00:00Added an answer on June 18, 2026 at 10:42 am

    Temp1 is of type Node *. Thus, you should call Temp1->Data() instead of Temp1.Data().

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

Sidebar

Related Questions

I have a template class with private constructor and destructor: template <typename T> class
Copy Constructor: // Copy constructor. Copies another list. CRevList(const CRevList &b) { cout <<
I have a template class: template<class T> class A{ T a, b; public: A(A<T>
I have non-template class with a templatized constructor. This code compiles for me. But
I have made a template class for a node in a linked list and
C++ Template: class MyClass { public: getNiCount(...) { } replaceNiWithNI(...) { } }; int
I have a template class template <class T> class myClass { public: /* functions
I have a template class ( Node is an inner class within a BST).
I have a template class which goes like this: class Template{ public $pageTitle =
I have an abstract template class template <typename T> class Predicate1 { public: Predicate1();

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.