One of the purposes of object-oriented design patterns is to hide complex …operations inside classes. And then, only expose the results, …without showing how the work is being done. …One of the tools that Visual Basic provides for this purpose is a read only property. …A property that can be set from within the class, but then only read from …outside it. I'll show how to create a read only …property, and then complete this exercise by moving all the complex functionality …of doing calculations into my calculation utility class.…
I'm looking in the read only solution, and I'll start in the CalUtility.vb file. …Currently, I have the four functions, AddValues, SubtractValues and so on, …which are returning values directly from the functions. …I'm going to change this code so that instead of returning values, they're …simply setting a value. I'll add a new private field that I'll …call result with an underscore prefix. And as with the other fields, I'll set …the data type to double. Next, I'll declare a property named result.…
Author
Updated
12/21/2016Released
6/14/2013- What is Visual Basic?
- Learning Visual Basic syntax
- Declaring variables and data types
- Working with numbers, Boolean values, and dates
- Using strings, words, and characters
- Repeating blocks of code with loops
- Evaluating conditions with if, then, and else
- Debugging and handling exceptions
- Managing ordered data with arrays
- Managing application logic with modules
- Defining custom classes
- Storing data with instance fields
Skill Level Beginner
Duration
Views
Related Courses
-
Access 2013 Essential Training
with Adam Wilbert5h 4m Beginner -
Excel 2013 Essential Training
with Dennis Taylor6h 32m Intermediate
-
Introduction
-
Welcome1m 6s
-
What you need to know3m 51s
-
Using the exercise files2m 33s
-
-
1. What Is Visual Basic?
-
Learning Visual Basic syntax7m 49s
-
2. Getting Started
-
3. Declaring and Using Variables
-
Working with data types6m 8s
-
Working with dates and times8m 33s
-
4. Exploring Syntax and Flow
-
Using Visual Basic operators9m 35s
-
-
5. Exception Handling and Debugging
-
Common compilation errors8m 49s
-
Common runtime errors5m 43s
-
-
6. Working with Complex Objects
-
Using the Object data type4m 44s
-
-
7. Organizing Code
-
Using constructor methods3m 21s
-
Conclusion
-
Next steps41s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Sharing data from classes with read-only properties