Creating Properties

you often don’t want to give code outside an object direct access to the data in the object. Instead, you can use properties, which use methods to set or get an internal value. We saw how to do that in Chapter 3; here’s an example from that chapter where I’m adding a property to a module:

See the topic “Creating Properties” in Chapter 3 for all the details, including how to create indexed properties. Note that you can make properties write-only with the WriteOnly keyword (and you must omit the Get method):

You can make properties read-only with the ReadOnly keyword (and you must omit the Set method):

Related solution: Found on page:
Creating Properties 132

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>