| | |
Constructor ?
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
actually I went the wrong way I think, below is the the partial code area and the bold shows what needs tobe, but I know I didnt do it right, can anyone show me an example or where to find help?
if (myFields[c_shapeNameField].equals(ShapeName.circle)){
//ASSIGN a new Circle object to shapes[index], passing the Circle constructor the following arguments:
Shape[index] = new Circle(Integer.parseInt(myFields[c_xCoordinateField]),
Integer.parseInt(myFields[c_yCoordinateField]), Integer.parseInt(myFields[c_radiusField]));
}
else if (myFields[c_shapeNameField].equals(ShapeName.cube)){
//ASSIGN a new Cube object to shapes[index], passing the Cube constructor the following arguments:
Cube shape = new Cube(Integer.parseInt(myFields[c_xCoordinateField]),
Integer.parseInt(myFields[c_yCoordinateField]), Integer.parseInt(myFields[c_sideField]));
}
else if (myFields[c_shapeNameField].equals(ShapeName.sphere)){
//ASSIGN a new Sphere object to shapes[index], passing the Sphere constructor the following arguments:
Sphere shape = new Sphere(Integer.parseInt(myFields[c_xCoordinateField]),
Integer.parseInt(myFields[c_yCoordinateField]), Integer.parseInt(myFields[c_radiusField]));
}
else if (myFields[c_shapeNameField].equals(ShapeName.square)){
//ASSIGN a new Square object to shapes[index], passing the Square constructor the following arguments:
Square shape = new Square(Integer.parseInt(myFields[c_xCoordinateField]),
Integer.parseInt(myFields[c_yCoordinateField]), Integer.parseInt(myFields[c_sideField]));
} Last edited by iwlu; Nov 27th, 2006 at 10:33 pm.
![]() |
Similar Threads
- Copy constructor in derived class (C)
- copy constructor problem (C++)
- How to call constructor for descendant of TObject ? (C++)
- Constructor (Java)
- Seg Fault from Matrix Data Constructor (C++)
- Constructor and Convertion operator are the same,how to avoid memory leak? (C++)
Other Threads in the Java Forum
- Previous Thread: Simpl JBank application
- Next Thread: Database error cord identify
| Thread Tools | Search this Thread |
actuate android api applet application applications array arrays automation balls bank binary bluetooth business c++ chat class classes clear client code codesnippet collections component database defaultmethod development dice doctype dragging ebook eclipse error event exception formatingtextintooltipjava fractal froglogic game givemetehcodez graphics gui hql html ide image infinite input integer intersect invokingapacheantprogrammatically j2me java javaprojects jni jpanel julia linux list loop looping map method methods mobile mysql netbeans newbie openjavafx parameter php print problem program programming project recursion repositories scanner screen scrollbar server set size sms sort sorting sql sqlserver state storm string sun superclass swing swt text-file threads tree windows






