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
  • PrintPrint
Share this Page URL
Help

Hour 8. Declaring Instance Variables in ... > Declaring Instance Variables and Pro...

Declaring Instance Variables and Properties

There are two ways of declaring the data elements that are part of a class. You can declare them as instance variables in the same way that you declare integers and floats. You can also declare them as properties of the class. This hour explores the use of instance variables. In the next hour, Hour 9, “Declaring Properties in an Interface File,” you find out how to use properties to accomplish the same results. With declared properties, the compiler actually generates the declarations you see in this hour along with accessors that help to enforce the opacity of objects that is a hallmark of good object-oriented design.


  

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
  • PrintPrint