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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:22:53+00:00 2026-06-13T16:22:53+00:00

As everyone knows: It’s possbile to create linkes lists with C / C++ in

  • 0

As everyone knows: It’s possbile to create linkes lists with C / C++ in order to make a program dynamical.
But now, I’m programming a “linked Class” in c++.
My Parent-Class “GAME” should have a variable number of Elements. And each Element is a class.
So I programmed this:

class GAME : public LEVEL
{  private:
     ELEMENT *startPointer;
   public:
     GAME()
     {    startPointer=NULL;
     }
     initGame()
     {    p=aStartPointer;
          while(p!=NULL);//This loop is based on a linked list, so its dynamic
          {   startPointer=new ELEMENT(startPointer);
              p=p->next;
          }
     }
}


class ELEMENT
{   private:
        ELEMENT *next;
    public:
        ELEMENT(ELEMENT* nextPointer)
        {    next=nextPointer;
        }
}

My Problem: I never heard about a linked class before, and I’m not sure if I should use it.
Does professional programmers use such methods (and is it usefull?), or are there better Methods to do this?

  • 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-13T16:22:55+00:00Added an answer on June 13, 2026 at 4:22 pm

    are there better Methods to do this?

    Yes. Here is one:

    class GAME : public LEVEL
    {  private:
         std::vector<ELEMENT> elements;
       ...
    };
    

    Use the standard library containers:

    • Generally, use std::vector<>.
    • If you need uniqueness, use std::set<>
    • If you need to associate elements with keys, use std::map<>
    • If you need to insert or delete items from the container very often or very quickly, use std::list<> or std::set<>
    • There are other considerations. Consult a good book to learn how to effectively use standard containers.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Everyone knows the advantages of a more readable code. So in order to make
I have HTML table in which user make GRUD operations. But everyone knows that
I think everyone knows this site http://pinterest.com/ and I don't want to create site
It seems everyone knows about the dumb little but in PhoneGap that doesn't allow
Everyone knows public class Test<T> where T : SomeBaseClass But is there a way
So, everyone knows ie9.js (from http://code.google.com/p/ie7-js/ ). It seems to work, but it never
Now, everyone knows the cute little trick where you punch this Javascript code into
I am new to Ruby as probably everyone here knows by now :) I
This is similar BUT NOT THE SAME as C# questions, but as everyone knows,
Everyone knows two of the ways to create an empty array: Array.new and []

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.