# Associte Property with Private variable

**URL:** <https://forums.visual-paradigm.com/t/associte-property-with-private-variable/8675>\
**Category:** General Questions/Discussions\
**Created:** [November 11, 2005, 3:59am UTC](https://forums.visual-paradigm.com/t/associte-property-with-private-variable/8675 "2005-11-11T03:59:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anonymous](https://avatars.discourse-cdn.com/v2/letter/a/8491ac/32.png) [@Anonymous](https://forums.visual-paradigm.com/u/Anonymous)\
**Post date:** [November 11, 2005, 3:59am UTC](https://forums.visual-paradigm.com/t/associte-property-with-private-variable/8675/1 "2005-11-11T03:59:57Z")

</div>

Hi,  
I have a class in which i have one Private variable and one public property.  
the code looks like:

Public Class Test  
Private m\_LocationId As Integer  
Private m\_LocationName As String

```
Public Property LocationId() As Integer
    Get
        Return m_LocationId
    End Get
    Set(ByVal Value As Integer)
        m_LocationId = Value
    End Set
End Property

```

End Class

When i reverse engineered this class in the class diagram, it creates 2 attributes, one as property and the other as private variable. I am curious that how this private memory variable is associated with the property?

on the other hand, I want to create the same class from class diagram, and want to associate the private variable with the propery, so when it generates the setter and getter, it sets and gets the values from private variable. My question is that, how we associate this private variable to the property from class diagram? Does any one have solution to this question?

---

<div class="post-metadata">

**Author:** ![Jick](https://avatars.discourse-cdn.com/v2/letter/j/ea666f/32.png) [@Jick](https://forums.visual-paradigm.com/u/Jick)\
**Post date:** [November 14, 2005, 9:37am UTC](https://forums.visual-paradigm.com/t/associte-property-with-private-variable/8675/2 "2005-11-14T09:37:09Z")

</div>

Hi,

To generate attribute in class diagram to Property in source code with getter and setter, you need to activate the Open Specification of attribute, open the Stereotype page and specify the attribute’s steroretype as “Property”, open the General page and then check getter and setter. Code generating from this attribute will be in the form of Property with getter and setting (skeleton only). However the property will not be associating with any private attribute. I have already forwarded your concern to our engineers to follow-up.

If there are any further questions, please let me know.

Best Regards,  
Jick

[quote=Anonymous]Hi,  
I have a class in which i have one Private variable and one public property.  
the code looks like:

Public Class Test  
Private m\_LocationId As Integer  
Private m\_LocationName As String

```
Public Property LocationId() As Integer
    Get
        Return m_LocationId
    End Get
    Set(ByVal Value As Integer)
        m_LocationId = Value
    End Set
End Property

```

End Class

When i reverse engineered this class in the class diagram, it creates 2 attributes, one as property and the other as private variable. I am curious that how this private memory variable is associated with the property?

on the other hand, I want to create the same class from class diagram, and want to associate the private variable with the propery, so when it generates the setter and getter, it sets and gets the values from private variable. My question is that, how we associate this private variable to the property from class diagram? Does any one have solution to this question?[/quote]
