Download presentation
Presentation is loading. Please wait.
1
CSCI 130 Classes and Objects
2
Classes Templates from which programmatic building blocks are constructed Model physical entities Have the ability to ‘construct’ instances of the templates Class contains: Attributes Behaviors
3
Example Write up the attributes and behaviors of a Car class
4
Objects Actual instance of a class
In an object-oriented program objects interact with each other Objects may be constructed from other objects Black box concept Other objects don’t care how an object performs its tasks, only that it does perform them
5
Important OOP concepts
The instances of each class have complete control over the accessibility of their attributes and behaviors as defined by the class Classes can be related in a hierarchical fashion from general to specific Some instances of classes have the ability to morph themselves into other (related) classes
6
Example Create a class hierarchy for all vehicle objects
7
Identifying Classes Done in design phase Most difficult part of OOP
define, design, code, test, document Most difficult part of OOP must view entire system in OO terms good initial design leads to highly effective programming bad initial design leads to wasted time and effort
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.