|
-
January 9th, 2011, 11:57 AM
#61
Re: Struct vs Class
To maintain compatibility wid c Mr. Bajarne introduced a new keyword in c++ named c++ and while using c++ compiler u can use struct same as class
-
January 10th, 2011, 09:17 AM
#62
Re: Struct vs Class
Besides the visibility of members,
Structs are value types and classes are reference types.
As you know, value types are allocated on the stack or inline as a part of another object while classes are allocated on the heap.
Struct is often a small object that needs to be treated like a primitive type while classes are normally used for implementation requiring more processing power. In other words, classes would normally be used to implement a piece of business logic, rather than to support data related or primitive-type objects.
I hope this clears it up a bit.
-
January 10th, 2011, 09:51 AM
#63
Re: Struct vs Class
 Originally Posted by amira7
Structs are value types and classes are reference types.
No God dammit! That is simply not true. Stop spreading around false information. As Paul already stated 5 years ago:
 Originally Posted by Paul McKenzie
There is *no*, *none*, *zero* difference between a "struct" and a "class" except for the access specifiers.
That is the only definitive answer.
Could a moderator get this thread locked once and for all?
Is your question related to IO?
Read this C++ FAQ article at parashift by Marshall Cline. In particular points 1-6.
It will explain how to correctly deal with IO, how to validate input, and why you shouldn't count on "while(!in.eof())". And it always makes for excellent reading.
-
January 10th, 2011, 09:57 AM
#64
Re: Struct vs Class
 Originally Posted by amira7
Structs are value types and classes are reference types.
Nonsense, wrong in C++. Already discussed many times in this 6 years-old thread.
 Originally Posted by monarch_dodra
Could a moderator get this thread locked once and for all?
My pleasure. 
[ Thread closed ]
Last edited by ovidiucucu; January 10th, 2011 at 10:02 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|