I have
class A{
}
class B : virtual public A{
  extra property 1
}
class C : virtual public A{
  extra property 2
}
class D : virtual public A{
}
class E : virtual public B, virtual public C, virtual public D{
  extra property 3
}
And here's my linked list's insert function:
template <typename T>
class LinkedList {
   Node<T> *start;
   Node<T> *current;
public:
void insert (T newElement)
{
  if ( isEmpty() )
  {
     insertToStart(newElement);
  }
  else
  {
     Node<T> *newNode = new Node<T>;
     newNode->info = newElement;
     newNode->next = NULL;
     current = start;
     while (current->next != NULL)
     {
        current = current->next;
     }
     current->next = newNode;
  }
}
Now I would like to create a single linked list that will store all instances of B, C and D without losing the additional attribute of each child class. How can I achieve this using pointer? I've tried the solution provided here, but it gives me this error: taking address of temporary [-fpermissive].
Linkedlist<A*> list;
B b;
list.insert(&b);
 
     
    