C++ Workshop - Overloading & Data Type Conversion (Ch. 10)

Started by
31 comments, last by Dbproguy 15 years, 11 months ago
Quote:Original post by bribaetz
has anyone else noticed that the last bloodshed release ide and compiler has a bug i does not have the iosstream im new at cpp so i need to know whats another good ide/compiler bundle excluding the free microsoft visual C++


Code::Blocks

Also Dev-C++ does have <iostream> (notice how it's spelled).

What's the code you used to determine this bug? And what's wrong with MSVC++ Express Edition?

Beginner in Game Development?  Read here. And read here.

 

Advertisement
Quote:Original post by bribaetz
has anyone else noticed that the last bloodshed release ide and compiler has a bug i does not have the iosstream im new at cpp so i need to know whats another good ide/compiler bundle excluding the free microsoft visual C++


For the record, just about any question you could possibly have has been asked and answered already somewhere in this Forum. I suggest that you read the thread Getting Started with C++ (Ch. 1 & 2) I bet someone there has had a similar problem.

Second, next time you have a problem compiling assume it is your fault and ask for help from the good folks here to find out what you did wrong. If it wasn't your fault (ie, your code is correct) then there was still a problem and the people here can help you figure out what it is.

Third, please don't cross-post. Ask a question in one location and wait for a response. Give it time, someone will see it eventually.

Fourth: Google is your friend. Statistically speaking, someone else has probably had the same or a similar problem to the one you are having.

Fifth:
  Step 1: Write code  Step 2: Compile code  Step 3: If there are errors, try and understand what the error is saying          and fix the code. Get help (from here, for instance) if needed.          After changing code, go to step 2.  Step 4: Run code.  If the output is not what you want, try and determine          what is going wrong. Get help if needed to change the code. Go to          step 2.  Step 5: You fixed all the errors!  Now, go back to step 1 and make a new program


Sixth: good luck.

C++: A Dialog | C++0x Features: Part1 (lambdas, auto, static_assert) , Part 2 (rvalue references) , Part 3 (decltype) | Write Games | Fix Your Timestep!

Well this chapter was somewhat simple again, some of this stuff is really cool though. I guess since there's no answer thread I'll do what J0Be is doing.

Chapter 10 Quiz

1. What differences are there, if any, between function overloading and method overloading?
None

2. What difference are there, if any, between using default parameters with functions and using default parameters with class methods.
None

3. When should you use function overloading instead of default values?
When the default value doesn't exist

4. What’s the primary purpose of a constructor?
Initializing variables and allocating memory

5. What happens if you do not explicitly create a constructor for your class?
The default constructor is created automatically.

6. If you DO explicitly create a constructor with a parameter list, does the compiler offer you the same service?
No, it'll only use your constructor.

7. What are two types of member variables which MUST be initialized in the initialization phase (initializer list) of the constructor?
References and const members.

8. When is the copy constructor called?
When a temporary object is created

9. What is a shallow copy? What problems can it cause?
Two objects hold the same pointer and if one deletes it then the other can't access it

10. What is a deep copy?
Two objects which hold a pointer have their stuff stored in different addresses.

11. What is the primary purpose for operator overloading?
To be able to use the operators on variables within an object.

12. How do you tell the compiler you want to overload the postfix, instead of the prefix operator?
The postfix is overloaded and has a null integer parameter.

13. Why do you need to return a temporary variable when overriding the postfix operator?
The postfix needs to increment before it's returned

14. Can you overload the mathematical, etc…for existing built-in types?
nope

15. What are the 4 default functions that are provided by the compiler if you don’t explicitly provide them.
Assignment operator, constructor, copy constructor, and the destructor.

16. What type of operators are created to convert from one data type into your custom data type and back again implicitely?
conversion

[Edited by - Dbproguy on May 23, 2008 12:03:22 PM]
--Dbproguy - My Blog - Tips, Opinions and Reviews about C++, Video Games, and Life

This topic is closed to new replies.

Advertisement