Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

structure and class

This is a discussion on structure and class within the C and C++ forums, part of the Software Development category; What is difference between structure and class in C++...

Go Back   Geeks Talk > Software Development > C and C++
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 12-07-2007
Junior Member
 
Join Date: Nov 2007
Location: Bangalore
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
jinendrashankar is on a distinguished road
structure and class

What is difference between structure and class in C++
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-08-2007
Junior Member
 
Join Date: Nov 2007
Location: Tanjore
Posts: 9
Thanks: 0
Thanked 5 Times in 4 Posts
venki_2007 is on a distinguished road
Re: structure and class

Hi!

Main difference between STRUCTURE and CLASS are follow:

STRUCTURE:

------------> The Structure is a collection of dissimilar data types
------------> By default the structure variables are PUBLIC
@ The structure have not an Encapsulation feature.
i.e We can access data anywhere in it's Scope (global or local etc).
@ We can't Initialize variables (structure contained data variables) within structure

CLASS:

----------> The CLASS is also a collection of dissimilar data types as well as ENCAPSULATION feature.
----------> By default the CLASS variables are PRIVATE.
@ Encapsulation means that the member data as well as member functions are hiding from external access.
i.e Only you can access member data by it's OBJECT (It's nothing but, CLASS VARIABLE) depends on
declaration of variables(member data) either PUBLIC or PRIVATE or PROTECTED.
@ We can initialize variables(data members) within CLASS by using INLINE function.
@ CLASS have some speciality as the INHERITANCE , POLYMORPHISM , OVERLOADING etc.

------>main difference
@some other difference



Regards
Venkat.G
Reply With Quote
  #3 (permalink)  
Old 12-23-2007
Expert Member
 
Join Date: Apr 2007
Location: Bangalore
Posts: 515
Thanks: 29
Thanked 63 Times in 61 Posts
susarlasireesha will become famous soon enough
Re: structure and class

The C++ class is an extension of the C language structure. Because the only difference between a structure and a class is that structure members have public access by default and class members have private access by default, you can use the keywords class or struct to define equivalent classes.
Reply With Quote
Reply

  Geeks Talk > Software Development > C and C++

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Structure of Salary nehalshah Companies 3 04-27-2009 04:51 PM
How to view the structure of the table Subashini.Ramasamy SQL Server 14 11-26-2007 07:58 AM
copy the Table Structure vcyogi SQL Server 3 08-04-2007 02:43 AM
Create your own structure Geek_Guest SAP R/3 1 07-17-2007 03:49 AM
I would like to get structure variable into workspace kamanianil C and C++ 0 07-05-2007 05:45 AM


All times are GMT -4. The time now is 11:17 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved