Наследование в java

    Date: 05/08/07 (Code WTF)    Keywords: no keywords

    public abstract class Figure {
    
    	protected Point a = null;
    	protected Point b = null;
    
    	private Dot dotA = null;
    	private Dot dotB = null;
    
    	public Figure() {
    		a = new Point();
    		b = new Point();
    	}
    
    	public Dot getDotA() {
    		System.out.println(a); //DEBUG
    		dotA = new Dot(a.getX(), a.getY(), 25);
    		return dotA;
    	}
    
    	public Dot getDotB() {
    		dotB = new Dot(b.getX(), b.getY(), 25);
    		return dotB;
    	}
    	...
    }
    
    
    public class Dot extends Figure {
    
    	private int SIZE;
    
    	public Dot(double x, double y, int size) {
    		super();
    		this.SIZE = size;
    	}
    	...
    }
    
    //WTF exemple Dot dot = new Dot(20, 30); dot.getDotA(); // OK dot.getDotA().getDotA().getDotA(); // also OK!

    PS
    Всё лишнее вырезал.

    PPS
    Может снабжать записи тегами? Хотя бы язык программирования указывать?

    Source: http://community.livejournal.com/code_wtf/84953.html

« Java... || а вы говорит... »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home