Object Oriented Programming Final Inheritance

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/14

flashcard set

Earn XP

Description and Tags

From Dr. Pittman's Lecture Slides

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No study sessions yet.

15 Terms

1
New cards

Inheritance

The idea that the child class inherits both data and behaviors from the parent class

2
New cards

Benefit of Inheritance

Allows us to make more generic classes from which more specific classes can inherit variables and methods.

3
New cards

Key Word for Inheritance

Extends -

public class Programmer extends Employee{}

4
New cards

Object Class

Automatically extended for every class

5
New cards

Object Class Public Methods

getClass()

hashCode()

toString()

equals()

6
New cards

Premade classes that inherit Object Class

String

ArrayList

Double

7
New cards

toString()

returns a String that represents the object

8
New cards

equals()

compares two objects by checking if their reference values are equivalent (same as ‘==’)

9
New cards

Superclass

Parent Class

10
New cards

Subclass

Child Class

11
New cards

super

super(name, address, phoneNumber, idNumber);

used to reference methods of the parent class

12
New cards

Use of Getters/Setters

If the Super class has any private variables or methods, the subclass will need the getters and setters to modify the private variables

13
New cards

Overriding

@Override

public String toString(){

this allows the method that was inherited to be rewritten to handle the specific need of the subclass while still using the same name and parameter

14
New cards

Overriding

A subclass provides a new implementation for a method defined in tis superclass

15
New cards

Overloading

Multiple methods in the same class share the same name but have different parameters