Abstract Software Type Structure

From GM-RKB
(Redirected from virtual method)
Jump to navigation Jump to search

An Abstract Software Type Structure is a software type structure that is a class that cannot be instantiated.



References

2021a

  • (Wikipedia, 20121) ⇒ https://en.wikipedia.org/wiki/Class_(computer_programming)#Abstract_and_concrete Retrieved:2021-10-24.
    • In a language that supports inheritance, an abstract class, or abstract base class (ABC), is a class that cannot be instantiated because it is either labeled as abstract or it simply specifies abstract methods (or virtual methods). An abstract class may provide implementations of some methods, and may also specify virtual methods via signatures that are to be implemented by direct or indirect descendants of the abstract class. Before a class derived from an abstract class can be instantiated, all abstract methods of its parent classes must be implemented by some class in the derivation chain.[1]

      Most object-oriented programming languages allow the programmer to specify which classes are considered abstract and will not allow these to be instantiated. For example, in Java, C# and PHP, the keyword abstract is used.[2][3] In C++, an abstract class is a class having at least one abstract method given by the appropriate syntax in that language (a pure virtual function in C++ parlance).

      A class consisting of only virtual methods is called a Pure Abstract Base Class (or Pure ABC) in C++ and is also known as an interface by users of the language.[4] Other languages, notably Java and C#, support a variant of abstract classes called an interface via a keyword in the language. In these languages, multiple inheritance is not allowed, but a class can implement multiple interfaces. Such a class can only contain abstract publicly accessible methods.[5][6][7][8]

      A concrete class is a class that can be instantiated, as opposed to abstract classes, which cannot.

  1. "Polymorphism". C++ Language Tutorial. cplusplus.com. Retrieved 2012-05-02.
  2. "Abstract Methods and Classes". The Java Tutorials. Oracle. Retrieved 2012-05-02
  3. "Class Abstraction". PHP Manual. The PHP Group. Retrieved 2012-05-02.
  4. "Polymorphism". C++ Language Tutorial. cplusplus.com. Retrieved 2012-05-02.
  5. "Abstract Methods and Classes". The Java Tutorials. Oracle. Retrieved 2012-05-02
  6. "Interfaces". The Java Tutorials. Oracle. Retrieved 2012-05-01.
  7. "Interfaces (C# Programming Guide)". C# Programming Guide. Microsoft. Retrieved 2013-08-15.
  8. "Inheritance (C# Programming Guide)". C# Programming Guide. Microsoft. Retrieved 2012-05-02.

2021b

  • (Wikipedia, 20121) ⇒ https://en.wikipedia.org/wiki/Abstract_type Retrieved:2021-10-24.
    • In programming languages, an abstract type is a type in a nominative type system that cannot be instantiated directly; a type that is not abstract – which can be instantiated – is called a concrete type. Every instance of an abstract type is an instance of some concrete subtype. Abstract types are also known as existential types.[1]

      An abstract type may provide no implementation, or an incomplete implementation. In some languages, abstract types with no implementation (rather than an incomplete implementation) are known as protocols, interfaces, signatures, or class types. In class-based object-oriented programming, abstract types are implemented as abstract classes (also known as abstract base classes), and concrete types as concrete classes. In generic programming, the analogous notion is a concept, which similarly specifies syntax and semantics, but does not require a subtype relationship: two unrelated types may satisfy the same concept.

      Often, abstract types will have one or more implementations provided separately, for example, in the form of concrete subtypes that can be instantiated. In object-oriented programming, an abstract class may include abstract methods or abstract properties[2] that are shared by its subclasses. Other names for language features that are (or may be) used to implement abstract types include traits, mixins, flavors, roles, or type classes.

  1. Mitchell, John C.; Plotkin, Gordon D.; Abstract Types Have Existential Type, ACM Transactions on Programming Languages and Systems, Vol. 10, No. 3, July 1988, pp. 470–502
  2. "Abstract Methods and Classes (The Java™ Tutorials > Learning the Java Language > Interfaces and Inheritance)". Oracle.com. Retrieved 2019-08-14.