VB interface programming

xiaoxiao2021-03-05  25

Today, I used VB interface programming to simulate the implementation of inheritance. The original VB's interface is so simple. I have always lazy to see about this.

First define a class iStatistic, which has a public property CAPTION and a public method searchPublic property get caption () AS STRINGEND Property

Public Function Search () AS ObjectEnd Function

Contemporary the IStatistic class as an interface, define a class statistic to implement the ISTATISTIC interface IMPLEments ISTATITISTICPUBLIC Property get iStatic_caption () AS String istatic_caption = "statistic capen" End Property

Public Function ISTATIC_Search () as myObject set iStatistic_search = new myobjectnd function

When calling the Statistic class, call public sub test () DIM OBJISTATIS as IStatistic

Set objistatis = new statistic

Msgbox objistatis.caption call objistatis.search () End Sub

转载请注明原文地址:https://www.9cbs.com/read-39072.html

New Post(0)