Apstraktna klasa

U objektno orijentiranom programiranju apstraktna klasa je računarska klasa koja ne može imati objekte. Njena osnovna svrha je da bude roditelj drugim, konkretnim klasama. Iz tog razloga ne može imati sve metode implementirane i treba imati barem jednu apstraktnu metodu, tj. čisto virtualnu metodu u C++u.

Primjer (Java)

uredi
abstract class Demo {
    // An abstract class may include abstract methods, which have no implementation.
    abstract public int sum(int x, int y);

    // An abstract class may also include concrete methods.
    public int product(int x, int y) { return x*y; }
}

interface DemoInterface {
    // All methods in an interface are abstract.
    int getLength();
}

Reference i vanjski linkovi

uredi
  • http://download.oracle.com/javase/tutorial/java/IandI/abstract.html
  • Riel, Arthur (1996). Object-Oriented Design Heuristics. Addison-Wesley Professional. p. 89. ISBN 0-201-63385-X.
  • Meyers, Scott (1996). More Effective C++. Addison-Wesley Professional. p. 258. ISBN 0-201-63371-X.
  • [www.headfirstlabs.com/books/hfjava/ Head First Java]. O'Reilly Media. 2003. str. 688. ISBN 0-596-00920-8. www.headfirstlabs.com/books/hfjava/.
  • Types and Programming Languages by Benjamin Pierce (MIT Press 2002) [1]
  • More Effective C++: 35 New Ways to Improve Your Programs and Designs by Scott Meyers (1995) ISBN 0-201-63371-X
  • Traits: Composable Units of Behavior by Nathanael Schärli, Stéphane Ducasse, Oscar Nierstrasz and Andrew Black


  Nedovršeni članak Apstraktna klasa koji govori o računarstvu treba dopuniti. Dopunite ga prema pravilima Wikipedije.