CPSC 233 Lecture Notes - Lecture 9: Object Copying, Unified Modeling Language
Document Summary
Eg: public class point extens object implements cloneable { public object clone() throws clonenotsupportedexception { return super. clone(); Point a,b; a = new point (3. 0,5. 0); try { By default, clone() does a shallow copy: i. e a bitwise copy from one chunk of memory to another. //won"t compile: expected the concrete subclasses will extend the abstract class. An abstract method has no code: consists of a method signature only, prepended with the keyword abstract. Eg: public abstract class shape { public abstract double area(): expected that an overriding method in a concrete subclass will supply an implementaion. A class that has one or more abstract methods is automaically abstract: you must use the abstract keyword for the class. Are denoted using italics: e. g. (uml diagram) Since italics are diicult to hand write, an alternate form uses the <> stereotype. An interface is a collecion of : unimplemented declaraions of methods, and/or, class constants.