Introduction to Classes and Objects Shirley Moore CS 1401 Spring 2013 cs1401spring2013.pbworks.com April 23, 2013
Agenda Announcements Finish More Array Fun exercise Introduction to Objects and Classes
Announcements UTEP STEM Career Day today – day.utep.edu/ day.utep.edu/ Women in Engineering (WIN) networking meeting, Thursday, April 25, 4-6pm, Eng E226 Exam 3 on Thursday, April 25 – Practice problems on course website under Lectures Extra Exam 3 Review with Peer Leaders – CCSB Tue 4/23 and Wed 4/24, 3-4pm Lab 8 (Algorithm Analysis) due today Unit 4 Plan posted on course website
Classes and Objects A class defines the properties (data fields) and behaviors (methods) for objects. Unified Modeling Languages (UML) – Standardizes class and object diagrams An object is an instantiation of a class.
Example: Circle Class and Objects Circle radius: double Circle() Circle(newRadius: double) getArea(): double getCircumference(): double getRadius(): double setRadius(newRadius: double): void Class name Data fields Constructors and methods circle1: Circle radius = 1.0 circle3: Circle radius = 12.8 circle2: Circle radius = 7.5