GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Placement Papers  >  TCS  >  C
Go To First  |  Previous Question  |  Next Question 
 C  |  Question 81 of 87    Print  
difference between class and structure

  
Total Answers and Comments: 10 Last Update: December 21, 2008     Asked by: nagalakshmi 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: laxmikanth
 

ans for this question is simple and it is:

There is no much difference between a class and a structure and the slight difference is the default scope of class is private where as the default scope of structure is global.



Above answer was rated as good by the following members:
piyush_dnma, ratneshict, myogeshchavan97
February 10, 2006 15:56:10   #1  
laxmikanth        

RE: difference between class and structure

ans for this question is simple and it is:

There is no much difference between a class and a structure and the slight difference is the default scope of class is private where as the default scope of structure is global.


 
Is this answer useful? Yes | NoAnswer is useful 2   Answer is not useful 0Overall Rating: +2    
May 18, 2006 01:39:13   #2  
Nilesh Korpe        

RE: difference between class and structure
Constructor is called in class where as there is no custructor for structor.
 
Is this answer useful? Yes | No
July 12, 2006 16:07:43   #3  
sachinpathare Member Since: July 2006   Contribution: 1    

RE: difference between class and structure
sorry nilesh but structres do have constructor. the only difference is that default scoop of class is Private and that to structure has public
 
Is this answer useful? Yes | No
July 29, 2006 00:57:33   #4  
harsha        

RE: difference between class and structure
a>the data members of a class are private by default where as those in structure are public.b>class can have the destructors while the structures cannot have.
 
Is this answer useful? Yes | No
November 28, 2006 00:42:19   #5  
pavankishore        

RE: difference between class and structure

class is a user defined data type in object oriented paradigm.

it consists of both data and code(methods).

where as structure is also a userdefined datatype but consists of only data members.not methods


 
Is this answer useful? Yes | No
December 10, 2006 06:34:36   #6  
swathi        

RE: difference between class and structure

Structures allows organisation of data whereas class allows both organisation of data and data security.


 
Is this answer useful? Yes | No
February 15, 2007 08:49:39   #7  
winny gupta Member Since: February 2007   Contribution: 8    

RE: difference between class and structure
Firstly a class is not declared in C.Secondly in C++ the main difference is all the data members and member functions in classes are private by default whereas for structure they are public.
 
Is this answer useful? Yes | No
March 04, 2007 13:19:27   #8  
Uttam        

RE: difference between class and structure
In C++ thr is no difference in class and structure except that in class by default scope is private but in structure its public...other than that no other difference.
 
Is this answer useful? Yes | No
June 27, 2008 10:12:57   #9  
lotus08 Member Since: June 2008   Contribution: 1    

RE: difference between class and structure
structure is a collection of data and class is a collection of data and functions.by defalut struct is public whereas class is private
 
Is this answer useful? Yes | No
December 21, 2008 13:02:41   #10  
Bhoomika sharma Member Since: December 2008   Contribution: 40    

RE: difference between class and structure
We can list as:

1. In classes the default scope is private whereas in structures u have public.equir

2.Also u can define the scope according to is requiremeuctunts in claasses.

3. In classes u can create fn nd methods which is not so in d case of structures.

4.You cn also do operator overloading in case of classes which is not so in d case of structures.

5.Various other object - oriented features are found in classes and not in structures wherin u can create objects which is not possible in structures.

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    


 
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