{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lecture 15 - Enhanced Class Design

Lecture 15 - Enhanced Class Design - o You must use the...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Enhanced Class Design Abstract Classes and Methods Are denoted with the keyword abstract o Eg public abstract class Shape{ } An abstract class cannot be instantiated o Eg Shape s = new Shape(); // Won’t compile o Expected that concrete subclasses will extend the abstract class An abstract method has no code o Consists of a method signature only, prepended with the keyword abstract o Eg public abstract class Shape { public abstract double area(); ... } o Expected that an overriding method in a concrete subclass will supply an implementation A class that has one or more abstract methods is automatically abstract
Image of page 1

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

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: o You must use the abstract keyword for the class o If a subclass does not implement all abstract methods of its parent(s), it is also abstract o It is common to have a mixture of concrete and abstract methods in an abstract class Abstract Classes and Methods in UML • Are denoted in italics • Shape + origin : Point; + area() : double • Since italics are difficult to hand write, an alternate form uses the <<abstract>> stereotype • <<abstract>> Shape...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern