preentation ................{

Embed Size (px)

Citation preview

  • 8/3/2019 preentation ................{

    1/38

  • 8/3/2019 preentation ................{

    2/38

    Presented to :-

    Sir Yasir.

    Group members :-

    Zeeshan Arshad 418

    Bakhtawar Abbas 423

    Arsalan Ali 435

  • 8/3/2019 preentation ................{

    3/38

  • 8/3/2019 preentation ................{

    4/38

    Programming language is defined as telling acomputer what to do through a special set ofinstructions which are then interpreted by thecomputer to perform some task.

    Different computer languages are C++

    Java

    C # C

    A++

    RUBY

  • 8/3/2019 preentation ................{

    5/38

    Most popular programming language.

    Intermediate level language.

    Vast application ranging from system softwareto entertainment software.

    It was developed by danish programmer

    BJARNE STROUSTRUP in 1979.

  • 8/3/2019 preentation ................{

    6/38

    Java is a popular and powerful language.

    Derived much of its syntax from c++.

    Less intermediate language.

    Particularly used for client-server webapplications.

    Developed byJames goslingat sun-microsoftand was released in 1995.

  • 8/3/2019 preentation ................{

    7/38

  • 8/3/2019 preentation ................{

    8/38

    Base

    Data types

    An intermediary power

    Functions

    pointers

    Operator overloading

    Classes and structures

    Inheritance

  • 8/3/2019 preentation ................{

    9/38

    C++ language is based on procedural ,functional and object oriented programming.

    Java strongly encourages only object oriented

    programming

  • 8/3/2019 preentation ................{

    10/38

    Both contain int, float , char data types.

    In c++ language char type is 8 bit type(ascii

    code)

    In java language char type is 16 bit type(uni-code character set)

  • 8/3/2019 preentation ................{

    11/38

    In c++ unsigned data type is used.

    In java there is no unsigned data type.

    like C++, Java provides a true boolean type.

    Unlike c++, java provides string type.

  • 8/3/2019 preentation ................{

    12/38

    In c++, the variable that can contain theaddress of another variable is called pointervariable.

    In java language we declare referencevariables(that contain the address of an object)

    Reference variable represents an advance overthe pointer mechanism

  • 8/3/2019 preentation ................{

    13/38

    In java and c++ we can use one variable tostore a list of data and manipulate them moreefficiently is called array.

    The syntax of declaration is same in bothlanguages.

    In java and c++, we access array elementthrough an index.

  • 8/3/2019 preentation ................{

    14/38

    Both in c++ an java the index starts from zeroto arrays (length -1).

    Unlike c++,Once an array is declared andconstructed in java the stored value of each

    member of the array will be initialized tozero.

  • 8/3/2019 preentation ................{

    15/38

    templates are used to define generic definitionof functions and classes.

    Unlike c++ , java does not support templates.

  • 8/3/2019 preentation ................{

    16/38

    The scope resolution operator (::) required inC++ is not used in Java. The dot is used to

    construct all fully-qualified references. Also,since there are no pointers, the pointer operator(->) used in C++ is not required in Java.

  • 8/3/2019 preentation ................{

    17/38

    The concept of classes is present both in c++ and java.

    A class definition in Java looks similar to a classdefinition in C++, but unlike C++ there is no

    semicolon at the end of the class defination in java .

    C++ requires that classes and functions be declared beforethey are used. But This is not necessary in Java.

  • 8/3/2019 preentation ................{

    18/38

    class Point /* C++ */ { public: Point(); Point(double xval, double yval); void move(double dx, double dy); double getX() const; double getY() const; private: double x; double y;

  • 8/3/2019 preentation ................{

    19/38

    . In C++, there are public and private sections,started by the keywords public and private. In

    Java, each individual item must be taggedwith public or private.

    In C++ the functions defined inside the classare called member variables in C++ are

    known as fields in java. In C+ functions declared inside the class are

    known as member functions while in javathese functions are called methods.

  • 8/3/2019 preentation ................{

    20/38

    Two important access specifiers are use.

    public :

    It allows the user to access inside as well as

    outside the class ,and can b accessed fromanywhere in the program.

    private :

    it is used to protect the data

  • 8/3/2019 preentation ................{

    21/38

    In C++ . .

    Main function

    Member functions

    In java. .

    No main function

    Member functions are called methods.

  • 8/3/2019 preentation ................{

    22/38

    Global function.

    Unlike c++ there is no concept of globalfunction in java.

    Inline function.

    Unlike c++ programmer can not request to

    make methods(functions) inline.

  • 8/3/2019 preentation ................{

    23/38

    Like C++, Java supports constructors.

    Similar to C++ you can initialize constructor

    function to your desire value.

    Lie C++ If you fail to provide a constructor , a

    default constructor will be provided for you.

  • 8/3/2019 preentation ................{

    24/38

    Copy constructor....There is no need of copy constructor in javawhile we require a copy constructor in C++ .

    Constructor overloading.

    Constructor can be overloaded both in C++ andJava .

  • 8/3/2019 preentation ................{

    25/38

    Unlike C++ there is no destructor function injava

    Unused memory is returned to the operatingsystem by way of agarbage collector, whichruns in a different thread from the mainprogram.

    This leads to a whole host of subtle andextremely important differences between Javaand C++.

  • 8/3/2019 preentation ................{

    26/38

    java performs automatic garbage collection toreclaim the memory that is occupied the

    objects that are no longer in use. when thereare no more references of an object than theobject is marked by garbage collection andmemory is reclaimed by garbage collector

  • 8/3/2019 preentation ................{

    27/38

    Like c++ , java supports single inheritancewhich is quite similar to c++ but the manner ofimplementation is different specially with

    respect to the use of constructor in inheritancechain.

    Unlike c++ multiple inheritance is not allowedin java.

  • 8/3/2019 preentation ................{

    28/38

    The process of defining additional meanings ofoperators is known as operator overloading.

    Operator overloading is allowed in c++,whereas there is no operator overloading.

  • 8/3/2019 preentation ................{

    29/38

    o Ruby is dynamic , reflective, general purposeobject oriented language. That combines syntaxinspired by PERL with SMALLTALK like

    features.

    o Ruby was originated in Japan in 1993.

    o The main reason of RUBYs popularity is itsweb application frame work i.e: RUBY onRAILS.

  • 8/3/2019 preentation ................{

    30/38

    Comparison between C++ and RUBY

  • 8/3/2019 preentation ................{

    31/38

    As with C++ , in RUBY

    Weve got mostly the same operators(even ::). its always just ..

    public, private, and protected do similar jobs.

    Inheritance syntax is still only one character,but its < instead of :.

  • 8/3/2019 preentation ................{

    32/38

    Unlike C++ in RUBY

    We dont need to compile our code ,we just run itdirectly.

    We have the END keyword after defining thingslike classes instead of having to put braces aroundblocks of code.

    All member variables are private

  • 8/3/2019 preentation ................{

    33/38

    Parenthesis in METHOD calls are optional andoften omitted.

    Everything is an object including numbers.

    There are no primitives or data types.

    Variables names are just labels.

  • 8/3/2019 preentation ................{

    34/38

    There is no METHOD overloading.

    Theres no type declaration , we just assign to

    new variable name as needed and they justspring up.

    For example:

    a = [1,2,3] ,Rather

    int a=[1,2,3]

  • 8/3/2019 preentation ................{

    35/38

    C++ and RUBY are very differentprogramming languages .Both languages areobject oriented , however RUBY uses dynamic

    typing whereas C++ uses STATIC typing.

    RUBY code is typically shorter and moreexpensive than its C++ counterpart.

  • 8/3/2019 preentation ................{

    36/38

    C++ JAVA RUBY

    (code execution )fast fastest slow

    need of compilation Need of compilation No need ofcompilation.(directly

    run)

    Includes primitives\classes.

    Additionally it providesability to create powerfulnew types calledclasses.

    Doesnt includeprimitives.

    Use braces withsemi colon afterdefining the class.

    use braces only Write end keywordafter defining theclass objects etc

  • 8/3/2019 preentation ................{

    37/38

    C++ JAVA RUBY

    function can beoverloaded.

    Methods can beoverloaded

    Methods cant beoverloaded

    longer code Relatively small code Shorter code

    any numaric valus willbe treated as constant. Will be treated as objects Will be treated asobjects.

  • 8/3/2019 preentation ................{

    38/38