Module 3 - Part 3 Abstract Classes Introduction

Module 3 - Part 3 Abstract Classes Introduction
1 / 1
Module 3 - Part 3 Abstract Classes Introduction - slide 1 of 16 Module 3 - Part 3 Abstract Classes Introduction - slide 2 of 16 Module 3 - Part 3 Abstract Classes Introduction - slide 3 of 16 Module 3 - Part 3 Abstract Classes Introduction - slide 4 of 16 Module 3 - Part 3 Abstract Classes Introduction - slide 5 of 16 Module 3 - Part 3 Abstract Classes Introduction - slide 6 of 16 Module 3 - Part 3 Abstract Classes Introduction - slide 7 of 16 Module 3 - Part 3 Abstract Classes Introduction - slide 8 of 16 Module 3 - Part 3 Abstract Classes Introduction - slide 9 of 16 Module 3 - Part 3 Abstract Classes Introduction - slide 10 of 16 Module 3 - Part 3 Abstract Classes Introduction - slide 11 of 16 Module 3 - Part 3 Abstract Classes Introduction - slide 12 of 16 Module 3 - Part 3 Abstract Classes Introduction - slide 13 of 16 Module 3 - Part 3 Abstract Classes Introduction - slide 14 of 16 Module 3 - Part 3 Abstract Classes Introduction - slide 15 of 16 Module 3 - Part 3 Abstract Classes Introduction - slide 16 of 16
Module 3 - Part 3 Abstract Classes Introduction Inheritance major advantage Reusing proven and debugged high-quality software. Some methods are not implemented in the parent But in the child subclass(es) These methods are called Abstract

Related Topics

Download this presentation From Below

"Module 3 - Part 3 Abstract Classes Introduction" is the property of its rightful owner. Permission is granted to download and print the materials on this website for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.

Presentation Transcript

01
Module 3 - Part 3 Abstract Classes<br>
02
Introduction Inheritance major advantage
Reusing proven and debugged high-quality software.

Some methods are not implemented in the parent
But in the child / subclass(es)
These methods are called Abstract<br>
03
Mammals Talking We’ve seen with inheritance that children classes “learn” how to do things from their parents.
In the last presentation we spoke about Mammal and it’s children Dog, Cat and Cow.
If we think about these for a moment, they all speak differently. Dogs say “woof”, Cats say “meow” and Cows “moo”.
So what should the talk method in Mammal say?
It doesn’t really make sense for it to say anything, since each child will do their own thing.
However, it does make sense for there to be a placeholder in mammal, because most mammals can talk.
This is where you’d use an abstract method.
It’s a placeholder which guarantees that all children will have a talk method
But it doesn’t have any code, since we don’t know what each child will do.
public talk();
Note: No {}’s with a body.<br>