Sign In | Subscribe
Start learning today, and be successful in your academic & professional career. Start Today!
Loading video...
This is a quick preview of the lesson. For full access, please Log In or Sign up.
For more information, please see full course syllabus of Java
  • Discussion

  • Study Guides

  • Download Lecture Slides

  • Table of Contents

  • Related Services

Bookmark and Share
Lecture Comments (4)

1 answer

Last reply by: Ismael Martin
Wed Dec 3, 2014 12:51 AM

Post by Ismael Martin on December 3, 2014

why is there an 11 in super in class C???
what does it do, and why isn't it explained???
super(11);

0 answers

Post by adel almaraghi on August 7, 2012

Yes. some of the details are always left!!

0 answers

Post by Bruno Riina on August 1, 2012

why instructor does not explain
"Subc x = new subc(9);" what is this? why we need it? why it is 9? why not 14?? some of the details are always left out makes it hard to follow through.

Inheritance

  • Inheritance and Composition are two different ways to quickly build multiple classes related to each other
  • Inheritance uses an “is-a” relationship like “An eagle is-a bird, or a falcon is-a bird”
  • Composition uses a “has-a” relationship like “A bird has-a beak, a bird has wings”
  • Composition will use a main class that “calls” other classes to build itself
  • Inheritance will use the “extends” keyword to create another class based on the super-class

Inheritance

Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.

  • Intro 0:00
  • Composition vs. Inheritance 0:07
    • Composition & Example
    • Inheritance & Example
  • Composition vs. Inheritance 2:04
    • Visual Diagram
  • Inheritance Class Structure 4:36
    • Parent Class
    • Child Class
    • Purpose of Inheritance
  • Method Overriding vs. Overloading 6:32
    • Method Overriding
    • Method Overloading
  • Inheritance Class Hierarchy 8:01
    • Inheritance Class Hierarchy
  • Protected Members 10:27
    • Public, Protected, and Private
  • Example 1: Basic Inheritance with Constructors 12:11
  • Example 2: Program Exhibits Both Composition and Inheritance 16:03
  • Example 3: Class Point Definition 21:07
  • Example 4: Class Quadrilateral Definition 22:15
  • Example 5: Class Trapezoid Definition 23:09
  • Example 6: Class Parallelogram Definition 24:05
  • Example 7: Class Rectangle Definition 24:37
  • Example 8: Class Square Definition 24:50
  • Example 9: Main Application for Shapes Exercise 25:42