How to read a string of text and create object of their class
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/4738405/how-can-i-store-objects-of-differing-types-in-a-c-container">How can I store objects of differing types in a C++ container?</a>  </p>
</blockquote>



<p>After reading a text file... </p>

<p>The following information is available</p>

<pre><code>Point2D, [3, 2]
Line3D, [7, 12, 3], [-9, 13, 68]
Point3D, [1, 3, 8]
Line2D, [5, 7], [3, 8]
Point2D, [3, 2]
Line3D, [7, -12, 3], [9, 13, 68]
Point3D, [6, 9, 5]
Point2D, [3, 2]
Line3D, [70, -120, -3], [-29, 1, 268]
Line3D, [25, -69, -33], [-2, -41, 58]
Point3D, [6, 9, -50]
</code></pre>

<p>The first data separate by the delimiter comma is the class name. for each of the 4 class</p>

<p>Point2D,Line3D,Point3D,Line2D</p>

<p>How do i like store them into relevant object base on their class means..</p>

<p>when it read first line</p>

<p>Point2D, [3, 2]</p>

<p>It will store it as Point2D object with the Data [3, 2]</p>

<p>But the issue is what dataset should i pick, Vector, Set , Map or List</p>

<p>I was thinking to actually create a data set then but i can't use new Point2D(); since</p>

<pre><code>Point2D is parent of Point3D
Line2D is parent of Line3D
</code></pre>

<p>and theres no parent class of Point2D and Line2D. how can i like create a object of them in a data set like e.g Vector</p>

<p>so Vector[0] is of Point2D class with data [3,2] , then Vector[1] is of Line3D class with data [7, 12, 3], [-9, 13, 68]</p>

<p><strong>Thanks for helping.!</strong></p>
