Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Classes vs. Structs

Posted on 1998-06-06
4
Medium Priority
?
204 Views
Last Modified: 2010-05-19
For a small collection, would it be better to use a class or a struct?  Which is faster?

Also, what is the best remedy to fight the ongoing carpal tunnel syndrome?

Please help!

0
Comment
Question by:ichor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 

Accepted Solution

by:
VisualLR earned 200 total points
ID: 1165331
For the first question, I'd have to say that a struct and a class are not the same, they are similar but they dont work the same.

See, a class is more advanced, and you can do a plethora of different things with it. You can derive other classes and all sorts of stuff... for more stuff on classes read "Beggining Visual C++ 4" from Wrox publishing.

And to fight carpal tunnel syndrome, I'd have to say it's "STOP CRYING YOU LIAR, ITS ALL IN YER HEAD!"
0
 
LVL 22

Expert Comment

by:nietod
ID: 1165332
I'm afraid VissualLR is incorrect on both counts!

structs and classes are 100
0
 

Expert Comment

by:VisualLR
ID: 1165333
no one asked you nietod... and no one was looking for a serious answer either. But if you're so sure... lemme see you derive a structure or inherit one...
0
 
LVL 22

Expert Comment

by:nietod
ID: 1165334
Woa!  I had a complete answer explaining the difference. and also recomending laproscopic surgery That's the first two lines!

Anyway what I had said was

Structurers and Classes 100 percent the same except for one minor difference.  Stuctures default to public members and public inheritance  and classes default to private members and private inheritence.  But these are defaults only.  They can be overridden with the public and private declarations.  Thus

struct ClasslikeStruct
{
private:
   int x;
};

Is just like

class ClassLikeClass
{
   int x;
};

As to the carpal tunnel. There is one answer.  Surgery.  And there is no reason to wait.  If you are going to have done, get it done earlier rather than later.  The sooner it is done the sooner you get relief.  However, make sure you get it done laproscopically.  The regular technique is butchery.  It involves an incission that runs almost from the wrist to the base of the fingers.  That is a huge incission and it takes many weaks to heal and makes it almost impossible to use your hand for about 6 weeks.  The laproscopic technique makes a small incission, less than an inch across the wrist.  This heals in about 2 weeks and you will be back to using your hand some in about 3 or 4 days and back to normal in about 2 weeks.  This also leaves no vissible scar.  

If your insurance will not pay for the laproscopic technique, whisc is about an extra $3,000 per hand, contact a lawyer.  You will be out of work considerably longer with the other technique and that is grounds for a suit, they will cave in quickly.

VissualRL
  No one did ask me.  But they asked you and you gave an incorrect answer.  enough said.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question