{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

Info iconThis 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
Background 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.
Background 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 ]}