Changes

Added History from old OOP page.
Line 1: Line 1:  
'''Object Oriented programming '''(OOP) languages are based around the paradigm of objects that interact with each other to produce functionality. There are many [[programming language]]s that are designed around object oriented principles, such as [[Java]].  A class is a definition of an object and contains data and/or functions.  Functions within a class are called "methods".   
 
'''Object Oriented programming '''(OOP) languages are based around the paradigm of objects that interact with each other to produce functionality. There are many [[programming language]]s that are designed around object oriented principles, such as [[Java]].  A class is a definition of an object and contains data and/or functions.  Functions within a class are called "methods".   
 +
 +
==History==
 +
The roots of OOP can be traced back to the 1960s and early 1970s. Early attempts to develop object-oriented languages and methodologies include Simula and Smalltalk. However, it was not until the late 1970s and early 1980s that OOP gained significant recognition with the development of languages like C++ and later, Java. These languages provided a practical framework for implementing object-oriented principles and quickly gained popularity.<ref>https://medium.com/javascript-scene/the-forgotten-history-of-oop-88d71b9b2d9f</ref>
    
==Definition==
 
==Definition==
Line 19: Line 22:  
A method is a function that is encapsulated within a class.  Methods have some level of scope and some mechanism for inheritance.
 
A method is a function that is encapsulated within a class.  Methods have some level of scope and some mechanism for inheritance.
   −
Different languages support different types of scoping.  Typically, these levels are:
+
Different languages support different levels of scoping.  Note that this scoping can apply to either data or methods, or both.  Typically, these levels are:
 
<ul>
 
<ul>
 
<li><b>Private</b>: The method is only visible to methods within the class.</li>
 
<li><b>Private</b>: The method is only visible to methods within the class.</li>
Line 35: Line 38:  
==Constructors and Destructors==
 
==Constructors and Destructors==
 
A constructor is a class method that is automatically called when an instance of the class is instantiated.  The purpose of the constructor is to set up the new instance.  A destructor is a method that is called when an instance of the class is destroyed.  The purpose of the destructor is to clean up just prior to the instance being deleted.  Typically this includes freeing memory pointed to by instance data.  Some programming languages support special constructors called "copy constructors" which are called when an instance is created as a copy of another instance.
 
A constructor is a class method that is automatically called when an instance of the class is instantiated.  The purpose of the constructor is to set up the new instance.  A destructor is a method that is called when an instance of the class is destroyed.  The purpose of the destructor is to clean up just prior to the instance being deleted.  Typically this includes freeing memory pointed to by instance data.  Some programming languages support special constructors called "copy constructors" which are called when an instance is created as a copy of another instance.
 +
 +
The creation of an object instance is referred to as <i>constructing</i> or <i>instantiating</i> the instance.  Destroying the object is called <i>destructing</i>, <i>destroying</i>, or <i>freeing</i> the instance.
    
== Example (Java)==
 
== Example (Java)==
SkipCaptcha
292

edits