Solved

Classes vs. Structs

Posted on 1998-06-06
4
200 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
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
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…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

821 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