Object-oriented language—An object-oriented language uses classes and objects. Classes
are similar to blue prints. A class describes what an object can contain, including
properties/variables and functions/methods. An object is an instance of a class (like a
building that has been created from a blueprint). Object-oriented languages provide
polymorphism, encapsulation, and inheritance. Objects are naturally encapsulated by
containing all related functions/methods and properties/variables within the object itself.
Polymorphism allows duplicate method/function names within object-oriented objects.
However, the “signature” must be different. The “signature” is the combination of the
types of variables (numbers and characters) passed into the method/function and the
type of information passed out of a method/function. For example, several add methods
could be created—one that only accepts integers (whole numbers), one that only accepts
floating point numbers (numbers with decimals), and one that accepts a combination.
The program will determine which method/function to call by what has been passed into
the method/function. Inheritance in object-oriented programming allows an object to
inherit properties/variables and functions/methods from another object. The object can
also override those items inherited. This is similar to a child inheriting characteristics from
the parents. Object-oriented languages can also be event-driven. An event-driven program
will “sleep” until an event occurs. This is similar to an ATM machine program waiting for
a user to input an ATM card.
Object-oriented language—An object-oriented language uses classes and objects. Classesare similar to blue prints. A class describes what an object can contain, includingproperties/variables and functions/methods. An object is an instance of a class (like abuilding that has been created from a blueprint). Object-oriented languages providepolymorphism, encapsulation, and inheritance. Objects are naturally encapsulated bycontaining all related functions/methods and properties/variables within the object itself.Polymorphism allows duplicate method/function names within object-oriented objects.However, the “signature” must be different. The “signature” is the combination of thetypes of variables (numbers and characters) passed into the method/function and thetype of information passed out of a method/function. For example, several add methodscould be created—one that only accepts integers (whole numbers), one that only acceptsfloating point numbers (numbers with decimals), and one that accepts a combination.The program will determine which method/function to call by what has been passed intothe method/function. Inheritance in object-oriented programming allows an object toinherit properties/variables and functions/methods from another object. The object canalso override those items inherited. This is similar to a child inheriting characteristics fromthe parents. Object-oriented languages can also be event-driven. An event-driven programwill “sleep” until an event occurs. This is similar to an ATM machine program waiting fora user to input an ATM card.
การแปล กรุณารอสักครู่..