Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

Chapter 10. Methods

In This Chapter

After having introduced the notion of types in Chapter 9, we’re now ready to zoom into a type’s members one by one. In this chapter, we focus on methods. Classes and structs act as containers for both data and operations. As you’ll see, all the available members emphasize one of those aspects. For methods, we’re clearly in the latter camp because they consist of code bodies. Users of the type can invoke those methods to carry out certain tasks that can modify state.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint