Tuesday, September 9, 2008

Apple Certification Exam 9L0-509

This is required e.g. to prevent memory-related problems that would result in case the default 9L0-509 copy-constructor or the default assignment operator is unintentionally applied to a class C which uses dynamically allocated memory, where a copy-constructor and an assignment operator are probably an overkill as they won't be used frequently.

Some style guidelines suggest making all classes non-copyable by default, and only enabling copying if it makes sense. Other (bad) guidelines say that you should always explicitly write 9L0-402 study guide the copy constructor and copy assignment operators; that's actually a bad idea, as it adds to the maintenance effort, adds to the work to read a class, is more likely to introduce errors than using the implicitly declared ones, and doesn't make sense for most object 9L0-509 types. A sensible guideline is to think about whether copying makes sense for a type; if it does, then first prefer to arrange that the compiler-generated copy operations will do the right thing (e.g., by holding all resources via resource management classes rather 9L0-402 audio exam than via raw pointers or handles), and if that's not reasonable then obey the . If copying doesn't make sense, you can disallow it in either of two idiomatic ways as shown below.

0 comments: