Abstract CLASSES and interfaces Abstract methods

Abstract CLASSES and interfaces Abstract methods
1 / 1
Abstract CLASSES and interfaces Abstract methods - slide 1 of 19 Abstract CLASSES and interfaces Abstract methods - slide 2 of 19 Abstract CLASSES and interfaces Abstract methods - slide 3 of 19 Abstract CLASSES and interfaces Abstract methods - slide 4 of 19 Abstract CLASSES and interfaces Abstract methods - slide 5 of 19 Abstract CLASSES and interfaces Abstract methods - slide 6 of 19 Abstract CLASSES and interfaces Abstract methods - slide 7 of 19 Abstract CLASSES and interfaces Abstract methods - slide 8 of 19 Abstract CLASSES and interfaces Abstract methods - slide 9 of 19 Abstract CLASSES and interfaces Abstract methods - slide 10 of 19 Abstract CLASSES and interfaces Abstract methods - slide 11 of 19 Abstract CLASSES and interfaces Abstract methods - slide 12 of 19 Abstract CLASSES and interfaces Abstract methods - slide 13 of 19 Abstract CLASSES and interfaces Abstract methods - slide 14 of 19 Abstract CLASSES and interfaces Abstract methods - slide 15 of 19 Abstract CLASSES and interfaces Abstract methods - slide 16 of 19 Abstract CLASSES and interfaces Abstract methods - slide 17 of 19 Abstract CLASSES and interfaces Abstract methods - slide 18 of 19 Abstract CLASSES and interfaces Abstract methods - slide 19 of 19
Abstract CLASSES and interfaces Abstract methods You can declare an object without defining it: Person p; Similarly, you can declare a method without defining it: public abstract void draw(int size); Notice that the body of the method is

Related Topics

Download this presentation From Below

"Abstract CLASSES and interfaces Abstract methods" 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
Abstract CLASSES and interfaces<br>
02
Abstract methods You can declare an object without defining it:
Person p;
Similarly, you can declare a method without defining it:
public abstract void draw(int size);
Notice that the body of the method is missing
Instead of { and } you just have a semi colon

A method that has been declared but not defined is an abstract method<br>
03
Abstract class Any class containing an abstract method is an abstract class
You must declare the class with the keyword abstract:
abstract class MyClass {...}
An abstract class is incomplete
It has “missing” method bodies
You cannot instantiate (create a new instance of) an abstract class<br>