我不确定以下代码会做什么.需要帮忙 [英] I am not sure what the following code does. Need help

查看:83
本文介绍了我不确定以下代码会做什么.需要帮忙的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码如下:-

I have a code as follows: -

Public Type ST
    id As Long
    state As Byte
End Type
    
Public Type FT
    status() As ST
End Type

Public Function GFT() As FT
    On Error GoTo errHandler
    Dim system As CSYS //this is a module
    Dim status_key As Variant
    Dim Index As Integer

    ''get each system states
    Index = 0
    For Each system In Systems
        FT.system_status(Index).id = system.ID
        FT.system_status(Index).state = system.operation_state
        Index = Index + 1
    Next system
    GFT = FT
    Exit Function
errHandler:
    GFT=FT
End Function




在这里我无法理解将函数声明为类型即
的含义.
我无法理解以下部分




Here I am not able to understand what does it mean when a function is declared as a type i.e.

I am not able to understand the following part

status() as FT



如果有人可以帮助我理解这一点,那将是一个很大的帮助.

-
AJ



If someone could help me understand that then it would be of a great help.

--
AJ

推荐答案

很简单:status是FT类型的Array

顺便说一句:我不喜欢VB的一件事!该数组使用与函数调用相同的括号,这可能会造成一些混乱. (C#,C,C ++等使用方括号[]是我喜欢的方式:))

干杯!

-MRB
That''s easy: status is an Array of type FT

BTW: One of the things I don''t like about VB! The array uses the same parenthesis as the function call which can be a little confusing. (C#, C, C++ etc. use brackets [] which is the way I like it :))

Cheers!

-MRB


这篇关于我不确定以下代码会做什么.需要帮忙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆