Class Declaration
| class | protocol | namespace | |
|---|---|---|---|
| ABAP Objects | class name definition «inheriting from parentclass». «interfaces: interfaces.» method_and_field_declarations endclass. class name implementation. method_implementations endclass. |
interface name. members endinterface. | |
| C++ (STL) | class name« : public parentclasses» { members }; | namespace name { members } | |
| C# | class name« : «parentclass»«, interfaces»» { members } | interface name« : parentinterfaces» { members } | |
| D | module name; members |
||
| Java | class name« extends parentclass»« implements interfaces» { members } | interface name« extends parentinterfaces» { members } | package name; members |
| PHP | namespace name; members | ||
| Objective-C | @interface name« : parentclass»«< protocols >» { instance_fields } method_and_property_declarations @end @implementation name method_implementations @end |
@protocol name«< parentprotocols >» members @end | |
| Python | class name«(parentclasses)»: Tab ↹ members |
__all__ = | |
| Visual Basic .NET | Class name« Inherits parentclass»« Implements interfaces» members End Class |
Interface name« Inherits parentinterfaces» members End Interface |
Namespace name members End Namespace |
| Eiffel | class name« inherit parentclasses» members end |
||
| Perl | package name; «@ISA = qw(parentclasses);» members 1; | package name; members | |
| Perl 6 | class name «is parentclass «is parentclass ...»» «does role «does role ...»» { members } | role name «does role «does role ...»» { members } | module name { members } |
| Ruby | class name« < parentclass» members end |
module name members end |
|
| Windows PowerShell | |||
| OCaml | class name «parameters» = object «(self)» «inherit parentclass «parameters» «inherit parentclass «parameters» ...»» members end | module name members |
|
| F# | type name«(parameters)» «as this» = class «inherit parentclass«(parameters)» «as base»» members «interface interface with implementation «interface interface with implementation ...»» end | type name = interface members end | namespace name members |
| Smalltalk | "The class is an Object. Just send a message to the superclass (st-80) or the destination namespace (Visualworks)" |
"The namespace is an Object. Just send a message to the parent namespace" |
|
Read more about this topic: Comparison Of Programming Languages (object-oriented Programming)
Famous quotes containing the words class and/or declaration:
“The history of all countries shows that the working class exclusively by its own effort is able to develop only trade-union consciousness.”
—Vladimir Ilyich Lenin (18701924)
“I foresee the time when the painter will paint that scene, no longer going to Rome for a subject; the poet will sing it; the historian record it; and, with the Landing of the Pilgrims and the Declaration of Independence, it will be the ornament of some future national gallery, when at least the present form of slavery shall be no more here. We shall then be at liberty to weep for Captain Brown. Then, and not till then, we will take our revenge.”
—Henry David Thoreau (18171862)