Sunteți pe pagina 1din 30

OOP LANGUAGES Comparison

M.Ammar Waseem (2010-EE-401) & Umar Draz (2010-EE-411)

A programming language is an artificial language designed to communicate instructions to a computer such as JAVA C++ C C# etc.

A language will be object oriented if it contains the following properties: Encapsulation Inheritance All user-defined types are objects All operations performed by sending message to object

C++ JAVA

C
C# Small talk

Eiffel

It was developed by SUN MICROSYSTEMS.


Its motto is Write Once Run Anywhere. It is used for all kinds of operating system specially

in WWW. Much of its syntax is derived from C++. Its latest edition is JAVA STANDARD EDITION (SE)6.

It was created by MICROSOFT .NET


Approved by ECMA & ISO as standard Its latest version is C#4.0

To create a Java program, you must ensure that the name

of the class in the file is the same as the name of the file (and that the file has the extension .java). To compile the program use the command javac as in: javac HelloWorld.java To run the compiled program use the command java as in: java HelloWorld

C++ provides both procedural and OOP

programming while JAVA has only OOP. There are no Global Function & Global Variable in JAVA. Arrays are different in JAVA. There is huge improvement of garbage collector in JAVA over C++.

In JAVA , all methods are defined in Class body. Thus

in C++ , all functions look like Inline but they may not be. All objects in JAVA are called by reference .It eliminate the need of copy constructor. Multithreading is standard feature of JAVA language. No destructor in JAVA. In C++ , static data members and functions are called using name of class and name of static member by :: In JAVA we can use only dot (.) operator (no -> or ::)

JAVA does not support Pointers.

Multiple inheritance is not allowed in JAVA.


You cant specify Public , Private , Protected

inheritance in JAVA as in C++.

Primitive type ( int ,float, char ,double).

Control Structure (if , if else, while).


Arithmetic expression . String type.

Both have classes.


Both have main function.

Pure OOP language.

Garbage collector.
Secure.

C++ supports inheritance. C # also supports inheritance but does not allow multiple inheritance.

In C++ ,an array is merely a pointer and in C#, arrays are objects that includes methods and properties. For example ,in C# , the size of an array can be queried via the length property.

In C++ a string is an array of characters. In C# strings are objects that support robust searching methods..

C++ supports the implicit hiding of method through inheritance. In c#, you must use the new modifier to explicitly hide an inherited members

C# does not support the Global variables. In this language, variables must be contained within the class.

C++ is not a garbage collected language whereas C# is a garbage collected language.

C++ supports pointer C# also supports pointers but in unsafe mode.

C++ supports the switch statement. C# also supports the switch statement but does not allow fall through from one case label to another.

C# uses destructors as the mechanism for writing finalization code. In C++, Destructors are usually used to de allocate memory and do other cleanup for a class object .

Variables Loops Constructors

A better language to write GUI applications Console applications Windows forms applications Web services Interactive websites Mobile device application Component libraries For modelling real life problems

4 your attention

S-ar putea să vă placă și