Results 1 to 4 of 4

Thread: What is structure and promotion rules of C++

  1. #1
    Join Date
    Dec 2010
    Posts
    16

    What is structure and promotion rules of C++

    Hey Friends, I wanted to know about the scope of object and variable in object oriented programming languages. In my college I was not able to understand this term which I think is very much important to understand. This term is in other object oriented languages. So, anybody who is aware of the above solution please let me know as soon as possible. It would be better if the term is explained with proper example.

  2. #2
    Join Date
    Apr 2009
    Posts
    488

    Re: What is structure and promotion rules of C++

    C++ perform automatic type promotion from one form to other from. The promotion from one type to another will be performed only when second type can hold all possible values of first type. For example the any value which is of type int can be promoted to long, float or double as the capacity of long, float and double is more .so loss of data from int type to long ,float or double will not be there. But int cannot be promoted to char as the capacity of char is less than the int so loss of data will be there. This is also known as implicit type casting

  3. #3
    Join Date
    Apr 2009
    Posts
    569

    Re: What is structure and promotion rules of C++

    The structure of the c++ is as follows
    # include statements
    # include statements

    class declaration
    void main()
    {
    variable declaration;
    object creation ;
    statements….
    statements….
    }

    The general structure of c++ indicate that it always contain
    #include : it is the one of the preprocessor which is required to include the various header files required in the program. A program can have any number of include statements.

    class declaration :This is the place where user can declare its global classes required in the program .user can declare any no. of classes.

    main() : this is the statement from where the program always starts its execution. This is a function. Inside this function one has to create no. of variables, objects and execute statements.

  4. #4
    Join Date
    May 2009
    Posts
    543

    Re: What is structure and promotion rules of C++

    The structure of C++ is declared first then variable is declared after variable is declared object is created and after creation of object the statements are executed. There could be number of statements after the object is created. One should know that when object is created then only one can execute the statement. Statements cannot be executed before an object is created. This is the most common mistake made by many them while creating a structure of C++.

Similar Threads

  1. Best online resources for website promotion?
    By rockwill in forum Off Topic Chat
    Replies: 1
    Last Post: 27-03-2012, 03:17 PM
  2. what is microsoft award promotion 2010
    By AADI-JI in forum Off Topic Chat
    Replies: 4
    Last Post: 10-01-2011, 07:50 PM
  3. Windows 7 Student promotion clean install now key invalid
    By Talaketu in forum Operating Systems
    Replies: 5
    Last Post: 31-07-2010, 11:22 AM
  4. Promotion code for anydvd
    By Cherrycooki in forum Windows Software
    Replies: 2
    Last Post: 10-08-2009, 12:02 PM
  5. Replies: 1
    Last Post: 02-02-2006, 06:46 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,715,811,171.11160 seconds with 17 queries