4.10 Wrap-Up

In this chapter, you learned basic object-oriented programming concepts of classes, objects, methods, instance variables, properties and constructors—these will be used in most substantial C# apps you create. You declared instance variables of a class to maintain data for each object of the class and declared Set and Get methods for operating on that data. We demonstrated how to call methods to perform their tasks and how to pass information to methods as arguments. Next, we showed C#’s more elegant property syntax for setting and getting data, and we demonstrated how to access properties to execute their set and get accessors. We discussed the differences between local variables of a method and instance variables of a class and that only instance variables are initialized automatically. You learned how to create auto-implemented properties that simply get or set an instance variable without any additional logic in the accessors’ declarations. You learned about type decimal for precise manipulation of numbers with decimal points, such as monetary amounts.

We showed how to create UML class diagrams that model the constructors, methods, properties and attributes of classes. You learned the value of declaring instance variables private and using public properties to manipulate them. For example, we demonstrated how set accessors in properties can be used to validate an instance variable’s potential new value before modifying the variable’s value.

In Chapter 5, we begin our introduction to control statements, which specify the order in which an app’s actions are performed. You’ll use these in your methods and properties to specify how they should perform their tasks.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset