title: How to use a virtual function from derived class, declared in another class with base class parameters?
body: <p>The problem is that i want to list elements from a class named Resource;
  In another class I have a function for this: <code>void KeyDistributionCenter::ListResources()</code> and i want to call a function called PRINT from derived class File or from class Server. Class Server and File are derived from Resources.
  I want to do this because in my derived class I have a PRINT function modified.(in File I print output file for example and in Server just general stuffs).</p>
  
  <p>In KeyDistributionCenter i have a list of Resources(not a list of derived File or Server). So how i know which print to call(what derived class is from Resources) and how can i do this?
  Thanks!</p>
  
  <p>Edit: My function print from Resources is virtual void print(); And i was thinking that if i declared like that it will know to acces print() function from File or Server.</p>
  
  <p>Edit 2: To be more precise: i have another function RegisterResource(Resource &amp;R) in my KeyDistributionCenter which add Resources to my std::vector resources(also vector is from KDC); Let s say i have a Resource File and all I want is when i call Print() function from KeyDistributionCenter(whit my vector list of Resources) to know what kind of Resource is and to call the print() function from File or Server class</p>