Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 08-01-2011
Member
 
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.
Reply With Quote
  #2  
Old 08-01-2011
Member
 
Join Date: Apr 2009
Posts: 484
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
Reply With Quote
  #3  
Old 08-01-2011
Member
 
Join Date: Apr 2009
Posts: 567
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.
Reply With Quote
  #4  
Old 08-01-2011
Member
 
Join Date: May 2009
Posts: 533
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++.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "What is structure and promotion rules of C++"
Thread Thread Starter Forum Replies Last Post
Best online resources for website promotion? rockwill Off Topic Chat 1 27-03-2012 03:17 PM
what is microsoft award promotion 2010 AADI-JI Off Topic Chat 4 10-01-2011 07:50 PM
Windows 7 Student promotion clean install now key invalid Talaketu Operating Systems 5 31-07-2010 11:22 AM
Promotion code for anydvd Cherrycooki Windows Software 2 10-08-2009 12:02 PM
MS DTC could not correctly process a DC Promotion/Demotion event. sevaanan Window 2000 Help 1 02-02-2006 06:46 AM


All times are GMT +5.5. The time now is 09:51 PM.