The difference between constructor and get set

  The constructor has the same name as the class and has no return type. The main function of the constructor is to perform some initialization operations when creating an object, such as assigning initial values ​​to member properties.
  For the properties of the class, we access and set them through the get and set accessors to ensure the security of the data in the class.
There are three types of accessors:

Write-only properties: Only set accessors are included.
Read-only property: Contains only get accessors.
Read-write properties: Contains both set accessors and get accessors.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326692850&siteId=291194637