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

how to make a class in the write way

$
0
0
im learing vb.net and I don't understand so good how to make a class.
I new that a class have properties and constructors and functions.

Example think of a person
A person get a First name and a family name
aren't that not the properties ?
Why is the in de code set to private and not public
And how can we acces a private property

Why do we use the constructor new.

vb.net Code:
  1. Class Person
  2.         Private _Name As String                                            ' (1)
  3.         Public Property Name() As String
  4.             Get
  5.                 Name = _Name                                               ' (2)
  6.             End Get
  7.             Set(ByVal value As String)
  8.                 _Name = value                                              ' (3)
  9.             End Set
  10.         End Property
  11.     End Class

Viewing all articles
Browse latest Browse all 27554

Trending Articles



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