Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

main driver class to instantiate my child classes  RSS feed

 
alaina peeler
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
im writting a program with an abstract class called shape. then i will write child classes of circle, square..and etc. .....im supposed to then write a main driver class that instantiate my child classes and exercise the behaviors i provide.........the behaviors are just area and circumference of each shape......im confused on the main driver class.....how do i use the driver class to instantiate my child classes and exercise their behaviors?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A more detailed paraphrase:

Write a class with a main() method with the proper signature. In that method, use the "new" operator to create instances of your classes. Store them into variables: some variables of type "Shape", and others of type "Square", "Triangle", etc. Then call their methods, and print the results.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!