Solved

Classes vs. Structs

Posted on 1998-06-06
4
201 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 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
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 additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

752 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