Chapter 8: Structs
When writing software applications, you might need to represent objects in the form of a structure that holds all their properties. For example, if you are writing a software application that deals with taking notes or a list of to-do items, you need to represent each note in the form of a structure. Assuming the most essential properties of a note are the text content of the note, the time of its creation, and a note ID to uniquely identify a note, these properties can be collectively placed inside a structure that represents a note. In V, you can create blueprints for representing objects using the struct
keyword. In this chapter, we will learn about these blueprints that are often referred to as structs. The following is the list of topics that we are going to learn in this chapter:
- Introducing structs
- Updating the fields of a struct
- Approaches to defining struct fields
- Defining methods for a struct
- Adding a struct as a field inside another...