VB6-member variable inheritance

I'm having problems with variable inheritance (public), let's say

Public Var As ClassThatIsIndependent

The declaration above does not create any problems for myself, however, if I inherit a class that holds it

Implements BaseClass

I get the error "the object module must implement a variable for the interface". I tried these options (as inside ChildClass)

Public Var As ClassThatIsIndependent

and

Public BaseClass_Var As ClassThatIsIndependent

But none of them solves the problem. Any alternative? I am open to possible Set / Get solutions, however I would prefer to support Var as a public variable.

+4
source share
1 answer

In the Visual Basic 6.0 Programming Guide, Polymorphism, Property Implementation Section :

, Animal Age, Public Declarations:

Option Explicit
Public Age As Double

"" Tyrannosaur Flea Age,

...

. Visual Basic .

. , :

Private mdblAge As Double

Private Property Get Animal_Age() As Double
   Animal_Age = mdblAge
End Property

Private Property Let Animal_Age(ByVal RHS As Double)
   mdblAge = RHS
End Property

, .

, " " , , Public Get/Let. Public variable Get/Let Property .

+7

Source: https://habr.com/ru/post/1688043/


All Articles