0% found this document useful (0 votes)
131 views32 pages

Adil Data PPT Final

The document provides an overview and comparison of the C++, Java, and C# programming languages. It discusses key features of each language such as syntax, object-oriented capabilities, memory management, and differences between them. C++ is characterized as a lower-level language with strict syntax, while Java and C# are higher-level with features like automatic garbage collection and platform independence. The document also provides code examples to illustrate differences in syntax between the languages.

Uploaded by

Adil Razzaq
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
131 views32 pages

Adil Data PPT Final

The document provides an overview and comparison of the C++, Java, and C# programming languages. It discusses key features of each language such as syntax, object-oriented capabilities, memory management, and differences between them. C++ is characterized as a lower-level language with strict syntax, while Java and C# are higher-level with features like automatic garbage collection and platform independence. The document also provides code examples to illustrate differences in syntax between the languages.

Uploaded by

Adil Razzaq
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 32

Presented to:

Sir M. Yasir Presented by:

Adil Razzaq Khubaib Akhlaq


Dated:

2010-EE-406 2010-EE-402

29th Nov, 2011

Highlights:
Introduction to C++ Syntax of C++ Features of C++ language Milestone in programming Operators and operator overloading Concept of inheritance Limitation of C++ language Introduction to Java Language Syntax for Java language Comparison b\w C++ & Java Difference of Syntax Summary and Conclusion Introduction to C# Syntax of C# Features of C# Uses of C# Comparison of C++ and C# Differences between C# and C++ Why C# Is Better Than C++

What is C++?
C++ is an intermediate language between low level and high level language. OR C++ is a statically typed(when type checking is performed during compile time as approach to run time), free-form, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features.

C++ was designed for the UNIX system environment. With C++ programmers could improve the quality of code they produced and reusable code was easier to write. There are many applications in our daily life using the applications of this language.

#include <iostream> #include<conio.h>

void main() { Clrscr(); cout<<"Hello, world<<endl; getch(); }

1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15.

Convenient language Well-structured language Case sensitivity Machine independence Object oriented Standard libraries Speed Operators and operator overloading Structured Types in C++ Dynamically Sized Arrays Building a linked list in C++ Object Orientation Classes in C++ Instances, constructors and destructors Inheritance

First programming milestone Name hiding with inheritance Constructors with inheritance Multiple inheritance Data abstraction Second programming milestone Friend functions The pointer this Referencing parent members and global Statics in classes

Third programming milestone Static vs. dynamic binding - virtual Virtual in C++ Input of items in C++ Output of items in C++ Output to files References to objects

Fourth programming milestone Templates - classes parameterized with types Function templates Exception handling in C++ Exception handling in C++

C++ introduces object-oriented programming (OOP) features to C. It offers classes, which provide the four features commonly present in OOP. Features are: Abstraction Encapsulation Inheritance Polymorphism Objects are instances of classes created at runtime. One distinguishing feature of C++ classes compared to classes in other programming languages is support for deterministic destructors, which in turn provide support for the Resource Allocation is Initialization concept.

Overloading an operator does not change the precedence of calculations involving the operator, nor does it change the number of operands that the operator uses (any operand may however be ignored by the operator, though it will be evaluated prior to execution). Overloaded "&&" and "||" operators lose their short-circuit evaluation property.
Operators that cannot be Overloaded Operator Scope Resolution Operator Symbol ::

Conditional Operator

?:

A programming technique that is used to reuse an existing class to build a new class is known as inheritance. The new class inherits all the behavior of the original. If a class B inherits from class A then it contains all the characteristics (information structure and behavior) of class A The parent class is called base class and the child class is called derived class Besides inherited characteristics, derived class may have its own unique characteristics
Person

Inheritance in Classes

tTeacher Student

Doctor

1. 2.

3. 4.

C++ is a lower level language It has large features, hence it has very strict syntax Lake of multithreading facilities C++ is intentionally is a multi paradigm(modular) language

Java is a high level language. It is an object oriented language. Java is general, concurrent, class based language.

Example The traditional Hello world program can be written in Java as: Class HelloWorldApp { publicstaticvoid main(String[]args){ System.out.println("Hello World!"); } }

C++
Hybrid object oriented language
Full multiple inheritance, including virtual inheritance. Multiple Inheritance It is a portable language

Java
Pure Object-oriented Single inheritance only from classes, multiple from interfaces. No multiple Inheritance It is a simple language

Allows procedural programming, functional Strongly encourages an object programming, object-oriented programming, and template meta programming oriented programming paradigm. Call through the Java Native Interface and Allows direct calls to native system libraries. recently Java Native Access

C++
Exposes low-level system facilities. Pointers, References and pass by value are

Java
Runs in a protected virtual machine. Primitive and reference data types always

supported
Explicit memory management. Supports destructors.

passed by value.
Automatic garbage collection. Doesn't have the concept of Destructors.

Supports class, structure, and union and can allocate them on heap or stack.

Supports only class and allocates them on the heap

The meaning of operators is generally Operator overloading for most operators

immutable, however the + and += operators


have been overloaded for Strings.

Java syntax has a context-free grammar which can be parsed by a simple LALR parser. C++ allows namespace-level constants, variables, and functions. In C++, objects are values, while in Java they are not. In C++ there is character limit while it is not in Java.

C++ is a high performance and powerful language. Most of the industry software is written in C/C++ JAVAs cross-platform compatibility and convenient APIs for networking and multi-threading have won it a place in the business world. Java does not support type defs, defines, or a preprocessor. Without a preprocessor, there are no provisions for including header files.

C# is designed to be a platform-independent language in the tradition of Java. It is an object oriented language.

Main has no return type, there are no semicolons after class names, there are some strange decisions regarding capitalization such as the capitalization of Main. Other a few differences, the syntax is often the same.

f(a,b,...)

function call Class Declaration

Class
Object Creation new class_name(...) Int, long Type name (integers)

class child : parent

Inheritance

Inheritance but C# does not support multiple inheritances. C# provides Interface. It also provides Garbage Collection. C# also provides direct access to memory through C++ style pointers. C# supports a strict Boolean data type bool. There are no global variables or functions. Checked exceptions are not present in C#.

C# is an elegant, simple, type-safe, object-oriented language that allows enterprise programmers to build a breadth of applications. C# also gives the capability to build durable systemlevel components. It also allows us to interoperate with other languages, across platforms, with legacy data

Differences between C# and C++: In C# there are no global functions. Everything is a class. C# does not support use of pointers, only references. There are no #includes unless you want to use unmanaged C++ in the same file as managed C++.

An Array is a group of consecutive memory Location with same name and type. An array must be declared before it is used. A typical declaration for an array in C++ is: type name [elements]; For example: int A[5];

C# arrays are zero indexed, that is, the array indexes start at zero.

When declaring an array, the square brackets ([]) must come after the type, not the identifier. Placing the brackets after the identifier is not legal syntax in C#. int[] table; // not int table[];

C++ too complex and unsafe


C++ system-dependent C++ not Web-ready C++ does not manage memory C++ has pointer types

You might also like