Tuesday, May 08, 2012 11:05 AMCreate a class named Service. Inside the Service class, declare a class variable named Started. The datatype of this variable is Boolean.
Public Class Service Dim started as Boolean End Class
Create a class named Server. Inside the Server class, declare a dynamic array that can contain elements of the type Service.(Note: For convenience, both the array and the variable Started can be accessible from a client program
that creates an instance of Server and Service respectively)
Create a constructor for the Service class. When the constructor is executed, it will set the value of the class variable Started to True.
Create two new classes: WebServer and DatabaseEngine. Both of these classes inherit from the class Service.
Inside the Service class, declare a Sub procedure (method) named Terminate. This method should display
the following text “Service stopping…” in a message box when executed. This method can be overridden in classes that inherit from Service class.
Inside both the WebServer and DatabaseEngine class, override the method Terminate inherited from their base class Service. Both methods should first call the base class Terminate method. The messages “Web server stopping…” and “Database engine stopping…” should also be displayed in a message box when the Terminate method for the WebServer and DatabaseEngine are called respectively. These messages should only be displayed if the Started variable inherited from their base class is not equal to False.
Inside the Server class, declare a method named Shutdown. This method does not return any value. When executed, it will call the Terminate method for each of the Service instances (if any) in the arrServices
array. You should call the Terminate method within a For Each loop that loops through the elements of the arrServices array.
In the Sub Main method, create an instance of the class Server. Set the size of the arrServices array in
your Server instance to contain 2 elements. Create first a WebServer instance and then a DatabaseEngine
instance into this array. Call the Shutdown method from your Server instance.
I could have done only a lil part. Can you guys help me with the rest? please?
- Edited by Tech_ Tuesday, May 08, 2012 11:08 AM
Wednesday, May 09, 2012 8:16 AM
Seems you're evident of what you need, so why not try to finish it?
Post your uncompleted codes here with your question will be better. It's only a suggestion :)