cs260 object oriented programming
play

CS260: Object Oriented Programming Inheritance - January 26, 2016 - PowerPoint PPT Presentation

CS260: Object Oriented Programming Inheritance - January 26, 2016 Quiz next time... UML Class Diagrams Overview Inheritance hw2 Questions Super extra credit example? Quiz next time... 1. What is an Object? a.


  1. CS260: Object Oriented Programming Inheritance - January 26, 2016

  2. ● Quiz next time... UML Class Diagrams ● Overview ● Inheritance hw2 Questions ● ○ Super extra credit example?

  3. Quiz next time... 1. What is an Object? a. Related variables and functions, encapsulated in a single type 2. What are the two parts of an Object? a. State b. Behavior 3. What is a Class a. A blueprint for creating Objects

  4. Quiz next time... 4. What is a method? a. A class function 5. What is a field? a. A class variable 6. What is a constructor? a. A function with the same name as it’s containing class that creates and sets up Objects

  5. Quiz next time... 7. Classes a. What does a class declaration look like? public class ClassNameHere { //this is where fields go ClassNameHere(){ //this is where we set up the class } //this is where methods go }

  6. UML Unified Modelling Language ● ○ Developed 1994 - 1995 Grady Booch, Ivar Jacobson, James Rumbaugh ○ ○ Standard software notations Diagrams ● ○ Class Diagram ○ Object Diagram ○ Use Case Diagram Wikipedia Link - https://en.wikipedia.org/wiki/Unified_Modeling_Language ●

  7. UML Class Diagrams Class Name ● ● State - Fields ● Behavior - Methods

  8. UML Class Diagram Example

  9. OOP - Inheritance ● What is inheritance? A way of deriving specific Classes from other, more general Classes ○ ○ Allows you to reuse code from a more general Class What does inheritance look like? ● ○ Standard Class declaration but with “extends” keyword public class ChildClass extends ParentClass { //this is where fields go ChildClass(){ //this is where we set up the class } //this is where methods go }

  10. Inheritance Example

  11. On your own… (not homework) Look at: ● Inheritance on official Java Docs - https://docs.oracle. ○ com/javase/tutorial/java/IandI/subclasses.html

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend