Lec14 - Lecture 14 Classes Todd Wittman PIC 10A Sec 5.1...

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

View Full Document Right Arrow Icon
1 Lecture 14: Classes Todd Wittman PIC 10A Sec 5.1 : Classes square6 Recall that a class is a suped-up data type equipped with special member functions . square6 We call an instance of a class an object . square6 The string class is an example of a class. string my_string = “hobbit”; class name object name value of object square6 The insert function is an example of a member function. my_string.insert(3,”orc”); //Use with a period after object name. square6 In Chapter 3, we saw some classes defined by your textbook author. square6 The Time class square6 The Employee class square6 Graphics classes: Point, Circle, Line, Message
Image of page 1

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

View Full Document Right Arrow Icon
2 Why Use Classes? square6 In Chapter 6, we’ll learn how to create our own classes. square6 Why bother? OK, that’s a fair question. square6 Suppose you’re a computer graphics programmer. square6 What other graphics objects would you like to have available besides Line, Circle, Point? square6 Triangle? Rectangle? Curve? Gollum? square6 What member functions would you like to add to the graphics objects? square6 changeColor? fillObject? setFontSize? square6 For business and banking, it might be useful to have a Database object to store numbers and make calculations. You can think of an Xcel spreadsheet as one of Microsoft’s objects. Sec 5.2 : Interfaces square6 Declaring a class is a lot like declaring a function.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the 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