GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Programming  >  C++
Go To First  |  Previous Question  |  Next Question 
 C++  |  Question 36 of 203    Print  
Difference between "C structure" and "C++ structure".

  
Total Answers and Comments: 10 Last Update: July 08, 2008     Asked by: suji 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: Vijay
 
Default behaviour of members in c Structures is public and in c++ structures is private. 

Above answer was rated as good by the following members:
YaelG, yzesong
September 25, 2005 07:26:11   #1  
Neetu Agrawal        

RE: Difference between "C structure" and "C++ structur...
C structures contain only data members where as c++ structure contains both data members and member functions as well.
 
Is this answer useful? Yes | No
October 22, 2005 09:49:43   #2  
mchauhan Member Since: October 2005   Contribution: 19    

RE: Difference between "C structure" and "C++ structur...
No difference are same laws for both cases.
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
October 23, 2005 01:50:17   #3  
Johnny        

RE: Difference between "C structure" and "C++ structur...
They are different. C struct can only contain data while C++ struct can contain functions and access limitation such as public private etc just as a class (not totally the same as class!)
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
January 02, 2006 08:41:43   #4  
Vijay        

RE: Difference between "C structure" and "C++ structur...
Default behaviour of members in c Structures is public and in c++ structures is private.
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 1Overall Rating: -N/A-    
January 17, 2006 03:43:30   #5  
chandrasekhar        

RE: Difference between "C structure" and "C++ structur...
The main difference is that c++ has bottom ot top approach and c has top to bottom approach.
 
Is this answer useful? Yes | No
March 01, 2006 20:08:36   #6  
Peter        

RE: Difference between "C structure" and "C++ structur...
in c++ the default structure members are public and private for class.
 
Is this answer useful? Yes | No
September 12, 2006 00:53:51   #7  
Priti Kamath        

RE: Difference between "C structure" and "C++ structur...

C++ and C structs are REALLY different

1)C++ structs are like C++ class except the default access for struct is public v/s class is private

2) C struct can have integral data type only unlike C++ struct that can also have member functions

3) C struct cannot have access scope like public private protected but C++ struct can.

4) struct A{ int i int j } ; typedef A A1; typedef needed for C struct and not required for C++ A can be directly accessed.


 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
March 26, 2007 13:06:31   #8  
keerthi        

RE: Difference between "C structure" and "C++ structur...
in c structure data are not intialised with in the structure where as in c++ intialisation is done through constructor.
 
Is this answer useful? Yes | No
May 07, 2008 00:02:22   #9  
wow_suraj Member Since: May 2008   Contribution: 22    

RE: Difference between "C structure" and "C++ structure".

Difference between 'C structure' and 'C++ structure' is that the structure in case of 'C' will only hold data definition whereas structure in 'C++' will contain both data definition and functions.


 
Is this answer useful? Yes | No
July 08, 2008 06:13:34   #10  
samitriani Member Since: December 2007   Contribution: 1    

RE: Difference between "C structure" and "C++ structure".
C does not have limitation access. Structures in C are used to regroup data from different types.

In C++ structure have limitation access propreties (private public protected) with public access as default can contain methods and can be used as a class.

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape