Week8Chap5-III - • Constructor(s of a class • Object...

Info icon This preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Janaka Balasooriya CSE 110, Arizona State University Chapter 5 Writing Classes - Summary
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Categorizing methods of a Class: Accessors and Mutators Because instance data is private, a class usually provides services to access and modify data values An accessor method returns the current value of a variable A mutator method changes the value of a variable The names of accessor and mutator methods take the form getX and setX , respectively, where X is the name of the value. (book use the name getter and setter to represent accessor and mutator methods)
Image of page 2
Janaka Balasooriya CSE 110, Arizona State University Writing Classes: Summary Analyze the Object and Identify Methods and Attributes Draw the UML diagram to represent the Object Implement the class Use the class in your program Some of the important concepts • public vs. private members (attributes and methods) static vs. non static members Encapsulation • toString() method
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: • Constructor (s) of a class • Object instances and instance related data • writing methods of a class • void methods • value returning methods Janaka Balasooriya CSE 110, Arizona State University Reading Assignment and Practice Questions Read Sections 5.1, 5.2, 5.3, 5.4, and 5.5 Review Lecture notes Practice Questions from the Book Self – Review Questions (You can find answers in the book) SR 5.1, 5.2, 5.3, 5.5, 5.13, 5.16, 5.17 Programming Questions PP 5.5 (here a getter method is a method that return a values, such as getter method for age is can be named as getAge() that returns the age of the age. Similarly, setter method set a values of a data member, such as getter method for age is can be named as setAge(int newAge), that sets the age) PP 5.6 Janaka Balasooriya CSE 110, Arizona State University Developing and Using Objects: activity...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern