CSC/ECE 517 Fall 2011/ch3 4b ms

From Expertiza_Wiki
Revision as of 04:54, 18 October 2011 by Mkotyad (talk | contribs) (Created page with "== Object oriented languages: An Overview == ==== C++: ==== C++ is a statically typed, multi-paradigm programming language. It supports some features of object-oriented language...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Object oriented languages: An Overview

C++:

C++ is a statically typed, multi-paradigm programming language. It supports some features of object-oriented languages like encapsulation, polymorphism and inheritance. It provides access control by specifiers public, private and protected and also allows “friend” classes. C++ allows multiple inheritance which is eliminated in most other programming languages as it allows a class to inherit from more than one base class which results in an ambiguity effect.

Java:

Java is classified as a statically typed, hybrid object oriented language. Although it provides information hiding, inheritance and polymorphism, it has a few basic types incorporated that are not objects and some of the built-in operators are provided by basic arithmetic and not as messages to objects. [link]. For these reasons, it is not considered to be a “pure” object-oriented language.

Java provides access control and supports private, public and protected access. It also allows to create packages to create and maintain namespaces. Java is designed not to provide multiple inheritance to avoid problems faced in C++. However, it presents a single-rooted hierarchy where “Object” is the ancestor of all classes (seen in Ruby too) and provides interfaces to extend/inherit functionality.

Python:

Python is a dynamically typed, interpreted, object oriented language. It is argued that Python is not completely object oriented as it does not provide access control.

Ruby: =

Ruby is dynamically typed and highly object-oriented, much more than Java and Python. In Ruby, it is said that “everything is an object”.  Every value happens to be an object in Ruby. You may call methods on a string, an integer just like you call on any object in Java.

Ruby : Purely Object Oriented

Ruby is considered to be a purely Object oriented Language, as everything in it is considered to be an object. Unlike Java, even primitives such as characters, punctuation, numbers and strings are treated as objects in Ruby. Ruby was designed to facilitate the enforcement of Object Oriented Methods. Ruby is a Dynamically Typed Language.

Object oriented Concepts in ruby:

Ruby is a singly rooted Object Oriented Programming language which has all its classes having the same superclass which is the class Object.

Classes: