+ All Categories
Home > Documents > Adil Data Ppt Final

Adil Data Ppt Final

Date post: 06-Apr-2018
Category:
Upload: adil-razzaq
View: 228 times
Download: 0 times
Share this document with a friend

of 32

Transcript
  • 8/3/2019 Adil Data Ppt Final

    1/32

  • 8/3/2019 Adil Data Ppt Final

    2/32

  • 8/3/2019 Adil Data Ppt Final

    3/32

    Presented to:

    Sir M. Yasir

    Presented by:

    Adil Razzaq 2010-EE-406

    Khubaib Akhlaq 2010-EE-402

    Dated:29th Nov, 2011

  • 8/3/2019 Adil Data Ppt Final

    4/32

    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++

  • 8/3/2019 Adil Data Ppt Final

    5/32

    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 anintermediate-level language, as it comprises a combination of

    both high-level and low-level language features.

  • 8/3/2019 Adil Data Ppt Final

    6/32

    C++ was designed for the UNIX system environment.

    With C++ programmers could improve the quality of

    code they produced and reusable code was easier towrite. There are many applications in our daily life

    using the applications of this language.

  • 8/3/2019 Adil Data Ppt Final

    7/32

    #include

    #include

    void main()

    {

    Clrscr();cout

  • 8/3/2019 Adil Data Ppt Final

    8/32

    1. Convenient language

    2. Well-structured language

    3. Case sensitivity

    4. Machine independence

    5. Object oriented6. Standard libraries

    7. Speed

    8. Operators and operator overloading

    9. Structured Types in C++

    10. Dynamically Sized Arrays11. Building a linked list in C++

    12. Object Orientation

    13. Classes in C++

    14. Instances, constructors and destructors

    15. Inheritance

  • 8/3/2019 Adil Data Ppt Final

    9/32

    First programming milestone

    Name hiding with inheritance

    Constructors with inheritanceMultiple inheritance

    Data abstraction

    Second programming milestone

    Friend functions

    The pointer this

    Referencing parent members and global

    Statics in classes

  • 8/3/2019 Adil Data Ppt Final

    10/32

    Third programming milestone

    Static vs. dynamic binding - virtualVirtual in C++Input of items in C++Output of items in C++

    Output to filesReferences to objects

    Fourth programming milestone

    Templates - classes parameterized with typesFunction templatesException handling in C++Exception handling in C++

    http://www.macs.hw.ac.uk/~rjp/Coursewww/CPPwww/graphex.htmlhttp://www.macs.hw.ac.uk/~rjp/Coursewww/CPPwww/graphex.html
  • 8/3/2019 Adil Data Ppt Final

    11/32

    C++ introduces object-oriented programming (OOP) features to C. Itoffers classes, which provide the four features commonly present in

    OOP.

    Features are:

    AbstractionEncapsulation

    Inheritance

    Polymorphism

    Objects are instances of classes created at runtime. One distinguishing

    feature of C++ classes compared to classes in other programminglanguages is support for deterministic destructors, which in turn provide

    support for the Resource Allocation is Initialization concept.

  • 8/3/2019 Adil Data Ppt Final

    12/32

    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 itwill be evaluated prior to execution). Overloaded "&&" and "||" operators lose

    their short-circuit evaluation property.

    Operators that cannot be OverloadedOperator Symbol

    Scope Resolution Operator ::

    Conditional Operator ?:

  • 8/3/2019 Adil Data Ppt Final

    13/32

    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.

    Inheritance in Classes

    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

    Student

    DoctortTeacher

  • 8/3/2019 Adil Data Ppt Final

    14/32

    1. C++ is a lower level language

    2. It has large features, hence it has very strict

    syntax3. Lake of multithreading facilities

    4. C++ is intentionally is a multiparadigm(modular) language

  • 8/3/2019 Adil Data Ppt Final

    15/32

    Java is a high level language.

    It is an object oriented language.

    Java is general, concurrent, class based language.

  • 8/3/2019 Adil Data Ppt Final

    16/32

    Example

    The traditional Hello world program can be written in Java

    as:

    Class HelloWorldApp {

    publicstaticvoid main(String[]args){

    System.out.println("Hello World!");

    }

    }

  • 8/3/2019 Adil Data Ppt Final

    17/32

    C++ Java

    Hybrid object oriented language Pure Object-oriented

    Full multiple inheritance, including virtual

    inheritance.

    Single inheritance only from classes, multiple

    from interfaces.Multiple Inheritance No multiple Inheritance

    It is a portable language It is a simple language

    Allows procedural programming, functional

    programming, object-oriented programming,

    and template meta programming

    Strongly encourages an object

    oriented programming paradigm.

    Allows direct calls to native system libraries.Call through the Java Native Interface and

    recently Java Native Access

  • 8/3/2019 Adil Data Ppt Final

    18/32

    C++ Java

    Exposes low-level system facilities. Runs in a protected virtual machine.

    Pointers, References and pass by value are

    supported

    Primitive and reference data types always

    passed by value.

    Explicit memory management. Supports

    destructors.

    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

    Operator overloading for most operators

    The meaning of operators is generally

    immutable, however the + and += operators

    have been overloaded for Strings.

  • 8/3/2019 Adil Data Ppt Final

    19/32

    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.

  • 8/3/2019 Adil Data Ppt Final

    20/32

    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 noprovisions for including header files.

  • 8/3/2019 Adil Data Ppt Final

    21/32

  • 8/3/2019 Adil Data Ppt Final

    22/32

    C# is designed to be a platform-independent

    language in the tradition of Java. It is an object

    oriented language.

  • 8/3/2019 Adil Data Ppt Final

    23/32

    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.

  • 8/3/2019 Adil Data Ppt Final

    24/32

    f(a,b,...) function call

    ClassClass Declaration

    new class_name(...)

    Object Creation

    Int, long Type name (integers)

    class child : parent Inheritance

  • 8/3/2019 Adil Data Ppt Final

    25/32

    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#.

  • 8/3/2019 Adil Data Ppt Final

    26/32

    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 system-level components.

    It also allows us to interoperate with other

    languages, across platforms, with legacy data

  • 8/3/2019 Adil Data Ppt Final

    27/32

    Differences between C# and C++:

    In C# there are no global functions. Everythingis a class.

    C# does not support use of pointers, onlyreferences.

    There are no #includes unless you want to use

    unmanaged C++ in the same file as managedC++.

  • 8/3/2019 Adil Data Ppt Final

    28/32

    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];

  • 8/3/2019 Adil Data Ppt Final

    29/32

    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[];

  • 8/3/2019 Adil Data Ppt Final

    30/32

    C++ too complex and unsafe

    C++ system-dependent

    C++ not Web-ready

    C++ does not manage memory

    C++ has pointer types

  • 8/3/2019 Adil Data Ppt Final

    31/32

  • 8/3/2019 Adil Data Ppt Final

    32/32


Recommended