Question: I have an assignment where I have to use a linked list of node with void\* as the data. I would be filling the nodes with an object. I want to know some way of accessing the members of the object after it is in the linked list, other than casting it to the class. Is it possible? Also, here's a chunk of my code just in case it helps clarify my question.

```
struct Node
{
    void* data_;
    Node* next_;

    Node()
    {
        data_ = 0;
        next_ = 0;
    }
};

class Star
{
private:
    char name_[ENTRY_SZ];
    long temperature_;
    double luminosity_;
    double mass_;
    double radius_;

public:
    static char filePath_[ENTRY_SZ];

    Star(char* name);
    void SetTemperature(char* temp);
    void SetLuminosity(char* lum);
    void SetMass(char* mass);
    void SetRadius(char* rad);
    void PrintToConsole();
    void AppendToFile();
};

```

I want to be able to call the PrintToConsole function after it is in a void\*.

Answer: 
You cannot work with the pointee of a `void*` without first casting it first. If it points at a `Star`, for example, you could do something like this:

```
static_cast<Star*>(data_)->PrintToConsole(); // Haha, Star star!

```

That said, in C++, it's pretty unusual to store things like this. You're much better off using a template class so that you get back the type information you need.
No. You have to cast it to the appropriate object.

I would question the reason on using void pointers.

I would also suggest a dynamic cast might be better