|
-
December 4th, 2003, 04:34 AM
#9
To add to Paul's reply:
Java and C# (AFAIK) don't actually copy objects: if you say "a = b" (where a and b have class type), then the object referred to by "a" has its reference count decremented, and the object referred to by "b"has its reference count incremented to reflect that it is now referred to by "a" as well. In C++, the same statement creates two independent copies of the same data - whatever data "a" originally contained is lost (overwritten). No reference counts involved. C++ doesn't do reference counting unless you implement it yourself. This is why copy constructors, copy assignment operators and destructors are so important - C++ makes you do your own resource management. Oh, and I should say that, IMHO although that may seem to be a disadvantage, it actually gives you a lot more flexibility than garbage collection once you're used to it.
Correct is better than fast. Simple is better than complex. Clear is better than cute. Safe is better than insecure.
-- Sutter and Alexandrescu, C++ Coding Standards
Programs must be written for people to read, and only incidentally for machines to execute.
-- Harold Abelson and Gerald Jay Sussman
The cheapest, fastest and most reliable components of a computer system are those that aren't there.
-- Gordon Bell
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
|