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 4107702
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:33:02+00:00 2026-05-20T21:33:02+00:00

I have a class assignment (read: no use of the STL) where I need

  • 0

I have a class assignment (read: no use of the STL) where I need to create a sorted linked list of objects, but I’m not quite sure how to go about doing this.

The class that I am using contains both integer and string members, but it is only one of these integer members that will be sorted. I currently have a fully functioning linked list template that will successfully run with integer data.

Now my problem lies in converting this to work with my class. When instantiating this linked list, a <Type> must be defined, in this case that type is Poster, after the class Poster that I am sorting. However, in the declaration of the linked list class, there is a declaration and definition of the class Node which reads

class Node
{
public:
    Type Element;
    Node *Next, *Previous;

    Node() : Next(NULL), Previous(NULL) {} // Default constructor
    Node (Type Data, Node *PNode = NULL) : // Non-default constructor
        Element (Data),
        Next (PNode),
        Previous (PNode) {}
};

I’m unsure how this existing definition will work when the members of Poster are introduced when LinkedList<Poster> listOfPosters is declared. Should I replace the above definition of Node with the contents of class Poster, or will Type Element in the node be marked as a sort of catch-all container for the members of class Poster, so that members of Poster can be accessible via Element.GetMemberValue()?

  • 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-05-20T21:33:02+00:00Added an answer on May 20, 2026 at 9:33 pm

    Im guessing that the declaration of the LinkedList class looks something like

    template<class Type>
    class LinkedList
    { ... }
    

    When the program that uses the linked list class (the main program) instantiates a LinkedList class like following

    LinkedList<Poster> myLinkedList;
    

    The compiler, at compile time, generates code from the template, and replaces all occurrences of “Type” with “Poster”. Therefore, you dont need to change the linked-list or node class.

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

Sidebar

Related Questions

I have to do an assignment for my class and it says not to
I have completed the assignment (yes it is for a programming class), but I
I have read Java String class is immutable and thread-safe but I am still
Can I optimize the class assignment here at all? I have to do this
As part of the last assignment in a beginner python programing class, I have
I want to have a base class which dictates the alignment of the objects
i have done coding in C# but not much inside the Console App (teacher
I have been given an assignment for university where i have to read from
I have an assignment that I have to create a randomly sized 3D array,
I need to create an generic data access layer to use in my final

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.