Extending the Bridge

Now suppose that we need to make some changes in the way these lists display the data. For example, you might want to have the products displayed in alphabetical order. You might think you'd need to either modify or subclass both the list and table classes. This can quickly get to be a maintenance nightmare, especially if more than two such displays eventually are needed. Instead, we simply make the changes in the extended interface class, creating a new sortBridge class similar to the...

State Pattern in VBNET

The State pattern in VB7 is similar to that in VB6. We use the same interfaces for the Memento and Drawing classes. Sub setSelected ByVal b As Boolean Sub draw ByVal g As Graphics Sub move ByVal xpt As Integer, ByVal ypt As Integer Function contains ByVal x As Integer, _ ByVal y As Integer As Boolean Sub setFill ByVal b As Boolean Property rects As vbpatterns.Rectangle End Interface However, there is some advantage in creating a State class with empty methods and overriding only those that a...