IT Community - Software Programming, Web Development and Technical Support

Differences between a C++ struct and C++ class

This is a discussion on Differences between a C++ struct and C++ class within the C and C++ Programming forums, part of the Software Development category; Differences between a C++ struct and C++ class The default member and base-class access specifiers are different. This is ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C and C++ Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 09-21-2007, 03:35 AM
vijayanand vijayanand is offline
D-Web Analyst
 
Join Date: Feb 2007
Posts: 293
vijayanand is on a distinguished road
Default Differences between a C++ struct and C++ class

Differences between a C++ struct and C++ class

The default member and base-class access specifiers are different.
This is one of the commonly misunderstood aspects of C++. Believe it or not, many programmers think that a C++ struct is just like a C struct, while a C++ class has inheritance, access specifiers, member functions, overloaded operators, and so on. Some of them have even written books about C++. Actually, the C++ struct has all the features of the class. The only differences are that a struct defaults to public member access and public base-class inheritance, and a class defaults to the private access specifier and private base-class inheritance. Getting this question wrong does not necessarily disqualify an applicant. Getting it right is a definite plus.
Saying, "I don't know" is definitely the wrong answer. I advance an unusual position about this. C++ programmers should at least believe that they know the differences, even when they are wrong about them. Getting it wrong is, therefore, right. You can explain the true difference in the interview and advance the programmer's knowledge. If they disagree vociferously, you have an opportunity to observe how they handle contentious debate when they are wrong and don't know it yet.
__________________

J.Vijayanand
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Reply


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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between a struct and a class in C# Sathish Kumar C# Programming 3 09-05-2007 08:11 AM
Is there any way to use keyPressed method of Canvas class in Form class? bluesky Mobile Software Development 1 07-25-2007 06:02 AM
Can anybody tell me Browser Differences in window.opener Behavior kingmaker HTML, CSS and Javascript Coding Techniques 2 07-24-2007 12:52 AM
differences between DIV and SPAN tag sivakumar HTML, CSS and Javascript Coding Techniques 1 07-11-2007 03:39 AM
C and C++ differences tripnautic C and C++ Programming 2 04-23-2007 02:39 AM


All times are GMT -7. The time now is 09:27 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0