presentation15 - Abstract Classes Soheil Hassas Yeganeh...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
Abstract Classes Soheil Hassas Yeganeh Computer Engineering Department Sharif University of Technology
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Two types of classes 2
Background image of page 2
Two types of classes A class that may have an object of its own type, is called a concrete class. A class is called abstract , if all instances of this class are of its descendant type. 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
An Example 3 Shape Rectangle Square Animal Mammal Cat Abstract Concrete
Background image of page 4
Abstract Class Characteristics 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Abstract Class Characteristics It can contains felds like other classes . But, as we know that any object oF its type is also oF its descendant type, there must be some methods that are implemented in all concrete descendant classes : Abstract Methods. In Java, we can have abstract classes that does not contain any abstract method. But, in a good design any abstract class has an abstract method. 4
Background image of page 6
abstract (1) 5 X.java abstract class X { public void i(){ } public static void main(String [] args){ new X(); } } It won’t compile.
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
abstract (1) The abstract modifer
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 23

presentation15 - Abstract Classes Soheil Hassas Yeganeh...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online