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. |
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++...
|
|||||||
|
|||
|
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 |
|
|||
|
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.
|
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
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 |