Solved

Classes vs. Structs

Posted on 1998-06-06
4
197 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
  • 2
  • 2
4 Comments
 

Accepted Solution

by:
VisualLR earned 50 total points
Comment Utility
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
Comment Utility
I'm afraid VissualLR is incorrect on both counts!

structs and classes are 100
0
 

Expert Comment

by:VisualLR
Comment Utility
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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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 viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now