Advertisement
Jozrael

Wesnoth coding test

Jul 25th, 2015
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. What is a virtual destructor? Why is it needed?
  2. Not sure - I'd guess something that tears down an object in memory and frees its resources, but I'm not sure what the virtual keywork is or why it's needed. Google ho!
  3.  
  4. What does the class template shared_ptr do? What is its purpose?
  5. Not sure - I'd assume templates are generics related (or maybe inheritance?), so maybe it allows multiple classes to share a single pointer? Doesn't sound right, should be easier than that.
  6.  
  7. What is a vector, and why would you use it?
  8. A vector is a resizeable array. You'd use it when you wanted had an unknown quantity of objects, and wanted quick access more than quick inserts or deletes.
  9.  
  10. What is a map, and why would you use it?
  11. A map is a key/value storing. It's a data structure used for linking pairs of information.
  12.  
  13. What are the differences between a reference and a pointer? When should each be used?
  14. Passing by reference as opposed to by value means that you're passing the location of the object in memory as opposed to a new copy of the object that is identical. Pointers are similar, pointing to the location in memory, but are easier to iterate with.
  15.  
  16. What is an iterator, and when is it used?
  17. An iterator is a pointer to a data structure that can be used to access sequential data in it.
  18.  
  19. What are the memory areas in a C++ program, and what is the purpose of each?
  20. No clue :\.
  21.  
  22. When should a member function be const? What effect does this have?
  23. Const is like static in java. It means a variable can't be changed after initialization. Not sure what it does for functions, classes, etc. in c++.
  24.  
  25. What is a copy constructor, and what is an assignment operator? When must you define them in a class?
  26. A copy constructor takes an existing object as an argument and makes a new version of it, duplicating its contents. I'm not sure when you must define them.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement