Hi guys,
I need help on getting the minimal scope on something.
I am learning data structures, right now i'm figuring out how to insert my class information (strings, ints, floats) into my node class.

Do i need to send data to my node each by each type?

or is there a way to encapsulate everything and send it?

I'm just looking for a web page, please don't think i'm asking for code, thanks in advance

Recommended Answers

All 4 Replies

It could be me, but I really don't understand what you're asking - could you be more specific please?

I want to insert my class instance in a node (the whole information), i want to know how to do it. Please I know its too much too ask, that is why I just want a pointer (see what i did there?) to some webpage or a chapter in a book.

I have a node class and a linkedlist class.

Pointers! My book chapter was weak on pointers, but another book had some excellent info on them.

Of course if anyone has comments to help me they are most welcome.

You can add an instance of a class just like any other variable:

class B
{
   int m_one;
   string m_two;
};
class A
{
   B instB;
};

Or if you just want a pointer to B:

class A
{
   B* instB;
public:
   A( const B& b )
   {
        instB = &b;
   }
};

Hope that is what you meant.

commented: Thanks!! +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.