GUI Based Program with Custom Class Definition and Instantiation
| Programming Features: |
- GUI Based Application
- Integer and String Variables
- Custom Class Definition
- Object Variable Declaration
- Custom Class Instantiation
- Cancel Class Instantiation from the Class Initialization Function
- Message Box Input and Output
| Description: |
- Program Phase Task 3 is a GUI based program that attempts to instantiate a custom class with data passed to the initialization function of the class. Inside the initialization function for the class, the user is prompted to continue instantiating the class. If the user selects the "yes" button, the initialization parameters are stored as class data, and the class is then instantiated. If the user selects the "no" button, the class instantiation is canceled. The part of the program that attempted to instantiate the class then checks to see if the class successfully instantiated. If it did, a class instance method is called. If it did not, the user is notified that the class did not instantiate.
- There are two source code files that make up Program Phase Task 3. The first file is the Entry Point of Execution (EPE) for the GUI based program. The second file contains the class definition for the custom class to be instantiated. A third file can be used as the header file for the class for the programming languages that support separate files for class definition and implementation.
- When the program is started, it attempts to instantiate a custom class called myclass. The initialization function for the myclass class displays a prompt in the form of a message box that asks the user to continue with instantiating the class.
- If the "No" button is selected, the class instantiation is canceled, and the following message box is displayed:
- If the "Yes" button is selected, the myclass class is instantiated, and the following message box is displayed:
| See Also |
| Program Phase List | |
| Program Phase Task 1 - Console Based Hello World! with Strings | |
| Program Phase Task 2 - Application Name Console Output | |
| Program Phase Task 4 - GUI Based Program with Main Window |