Content deleted Content added
Fixing first sentence |
→Accessor, mutator and manager methods: Fix citation issues. Add main articles |
||
Line 20:
===Constructors===
{{Main|Constructor (computer science)}}
A [[Constructor (computer science)|''constructor'']] is a method that is called at the beginning of an object's lifetime to create and initialize the object, a process called [[object creation|construction]] (or ''instantiation''). Initialization may include an acquisition of resources. Constructors may have parameters but usually do not return values in most languages. See the following example in Java:
Line 35 ⟶ 37:
===Destructors===
{{Main|Destructor (computer science)}}
A ''[[Destructor (computer science)|destructor]]'' is a method that is called automatically at the end of an object's lifetime, a process called [[object lifetime|destruction]]. Destruction in most languages does not allow destructor method arguments nor return values. Destruction can be implemented so as to perform cleanup chores and other tasks at object destruction.
====Finalizers====
In [[Garbage collection (computer science)|garbage-collected]] languages, such as [[Java (programming language)|Java]],<ref name=Bloch>{{cite book | title= "Effective Java: Programming Language Guide" |last=Bloch| first=Joshua| publisher=Addison-Wesley | edition=third | isbn=978-0134685991| year=2018}}</ref>{{rp|26, 29}} [[C Sharp (programming language)|C#]]<ref name=Albahari>{{cite book |last=Albahari |first=Joseph |title= C# 10 in a Nutshell |publisher= O'Reilly |isbn= 978-1-098-12195-2}}</ref>{{rp|208-209}}
==Abstract methods==
|