Save this video free

CSCE145 F2026 07 Inheritance and Polymorphism Part 01

UofSC_CSCE145_CSCE146 · 34:56 · Watch on YouTube

Part of University of South Carolina CSCE 145. See all 19 lectures and search them

These notes were made with YouTube Collector. Paste any YouTube link and get the same: a summary, chapters and a searchable transcript.

Overview

Java inheritance lets a subclass extend a superclass through an “is-a” relationship: shared data and behavior can live in general classes, while specialized classes add their own features. The lecture builds a university personnel example from Person to Student to Undergraduate, demonstrating `extends`, `super` constructors and method calls, overriding `toString` and `equals`, and polymorphic substitution in a `Person[]`.

Key takeaways

Chapters

0:00 Java Inheritance, Constructors, and Method Overriding
8:27 Designing a University Personnel Class Hierarchy
14:07 Implementing Person and Student with `super`
23:33 Extending Student with Undergraduate Level Data
29:26 Polymorphism, Type Substitution, and Java’s Object Methods
32:41 Storing Person, Student, and Undergraduate Together

Keep these chapters and the full searchable transcript in your own library.

Transcript excerpt

0:00 Hey everyone, how goes it? And welcome back to computer science 145. Today we're going to discuss inheritance and polymorphism. In previous lectures, we've been discussing code organization. Along with this, we've been introducing these concepts called object-oriented programming. One of the major concepts of object-oriented programming that we've gone over is called encapsulation. In other words, information hiding. Now we're going to discuss the other two principles of object-oriented programming. Inheritance and polymorphism. Inheritance allows data and methods to be inherited to be absorbed from one class to another. Now in Java, this occurs between two classes. You have what's called the subclass or the child, and this is the

0:49 class that is inheriting from another. You also have the superass the parent and this is the class that is being inherited. Now in a lot of ways this does work like biological inheritance where you inherit properties from your parents. Now this concept is great for extending the properties and functionality from one class into another. The best way to think about this is the subclass becomes a more specific version of the superclass and the superclass is a more general version of the subclass. This also creates what's called an is a relationship. So the child is a more specific version

1:37 of the parent. Private properties and methods are not inherited from the superass. However, they can still be used. Instance variables from the superass have to be accessed through their accessors and also instance variables can be modified in the superclass via their mutators. Now, in order to start using inheritance, the reserved word extends is used to inherit from one class into another. So, for instance, inside of the class definition, you have public class and then the subclasses identifier. Then you have this reserved word extends followed

This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.

In this course

Related notes

Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, UofSC_CSCE145_CSCE146.

Want the full transcript?

Save this video in YouTube Collector to get its complete searchable transcript, your own AI summaries, and a library that keeps every video you collect in one place.