Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2010 Private Structure-Public Variable in Class

$
0
0
I am clearly getting a concept wrong somewhere but I cannot see why this cannot be done; it appears logical to me this should be possible.

I am building a class within vb.net and have created a structure within the class:

Code:

Structure flags
        Dim carry_flag As Boolean      ' Holds the carry out of the MSB in any arithmetic operation. In subtraction, holds 0 if borrowed and 1 if not
        Dim zero_flag As Boolean        ' Set to 1 when an operation produces a zero result
        Dim interrupt_flag As Boolean  ' Enables (0) or disables (1) interrupts
        Dim decimal_flag As Boolean    ' If 1, any ADC or SBC is treated as BCD, with the result also being BCD
        Dim brk_flag As Boolean        ' Set (1) if software interrupt (BRK) is executed
        Dim overflow_flag As Boolean    ' Set (1) when an arithmetic operation results in a value too large to be represented in a byte
        Dim sign_flag As Boolean        ' Set (1) if the result of an operation is negative
    End Structure

I have then based a variable on this structure:

Code:

Public status_register As flags
The thing is, I want the variable to be public but I do not want the structure to be available outside of the class.

Therefore, logically, I want the structure to be PRIVATE and the variable to be PUBLIC but I get told by VB.NET that this is not possible or permitted.

Is there a methodology I am missing or a logical step I am ignoring or am I simply misguided?

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>