DeVry GSP125 All Discussions latest 2016

DeVry GSP125 Week 1 Discussion 1 & 2 latest 2016dq 1Objects and Classes (graded)What is the difference between a class and an object? How is each used?What is object-oriented programming for, anyway? Why did programmers invent classes?Object-oriented programming is considered a tier of structured programming, the previous tier being called modular and the one before that being called procedural. Can anyone explain what modular or procedural means?Has anyone found any resources on the Internet that do a good job explaining OOP?In the code below, what is the function inside of the class that has the same name as the class called? What does it do? Could this particular function be written another way that is more efficient for the computer?classCoordinate{
int x, y;
Coordinate(int a_x,int a_y){
x= a_x;
y= a_y;
};dq 2Object-Oriented Terminology (graded)What does object oriented mean? What makes a language object oriented?What do these terms mean?Member variable / property / attribute / fieldMember function / method / behaviorMember operatorCompositionEncapsulationAbstractionDeVry GSP125 Week 2 Discussion 1 & 2 latest 2016dq 1Pointers (graded)Describe how pointers are used with arrays. Are arrays necessary when using a pointer?What is a pointer?What is the difference between a pointer and an array? How are they related?What is the difference between the address-ofoperator and the dereferenceoperator? Can someone show an example of using the address-of and dereferenceoperators?Can a pointer point at another pointer? What would the syntax for that look like? Why would a pointer-to-a-pointer be useful?dq 2Default Arguments (graded)What is a default argument? Start by defining the term and follow with an example. Your example should be different than those of your classmates.Why are default arguments “bad?”What is memory allocation? Why is it important?Why not just use regular variables for everything? Why is it important to allocate memory at run time instead of at compile time?Will the code below compile? What will this code do (if it does compile)?#include
usingnamespace std;
void printMessage(char* a_message=”Hello World!”)
cout<< a_message<< endl}int main(){ printMessage(); printMessage(“Goodbye Console!”); return0;DeVry GSP125 Week 3 Discussion 1 & 2 latest 2016dq 1Copy Constructors (graded)Define and discuss copy constructors.What is a default constructor? What is a default constructor for?What is a copy constructor? How is it different from a regular constructor? Can someone show a compilable example?What is an initialization list? How about an initializer list? How are these related to a constructor?Has anyone ever heard of the OOP rule of three?What is an example of when the compiler would call a default constructor without telling you? When would it call a copy constructor without telling you? Would it ever call a destructor without telling you?dq 2Inheritance (graded)What is inheritance and what type of relationship is it? How would you use it in game design?Can someone give an example of what inheritance looks like in code?Are there any functions that a child class will not inherit from a parent class?How many parent classes can a child class have? What limits multiple inheritance?Most object-oriented programming languages do not support full multiple inheritance the same way C++ does. Does anyone know why that would be?What is the diamond of death? Can someone provide an example?DeVry GSP125 Week 4 Discussion 1 & 2 latest 2016dq 1Inheritance and Notation (graded)We discussed inheritance last week. Let us look deeper at the notation. How would you indicate the class being declared in C++? What does the colon indicate about a class in inheritance notation?Does anyone know why the semicolon is needed after the curly bracket of a class? Does that semicolon have any side effects?Can a struct inherit from a class? Can a class inherit from a struct?What is the difference between a class and a struct? Is there a reason to make something a struct instead of a class?dq 2Facilitating Code Reuse (graded)What technique can you use to facilitate the reuse of code? Discuss this technique in detail and provide an example.What is DRY? What does object-oriented programming have to do with DRY?Why would someone make a private (or protected) function in a class? Wouldn’t that limit code reuse? What would be the rationale for something like that?Consider the following example.structVector2{float x, y;};structRectA{ Vector2 min, max;};structRectB:publicVector2{ Vector2 size;};What is the difference between RectA and RectB? What is the same in each one?DeVry GSP125 Week 5 Discussion 1 & 2 latest 2016dq 1Virtual Functions (Graded)What are virtual functions? How do you use them in game design?What is an interface (also called an abstraction)? What does it have to do with polymorphism and virtual functions?What is a pure virtual function? What is its purpose?Find a game on the Web. What kind of classes do you think it would use in its code?Imagine you have a puzzle game in which pieces can be groups of connected blocks and/or tiled images and can be used in the same game at the same time. In this example, I would want a base class that makes a virtual draw, rotate, collide, and probably getType as well. Below is an example.classPuzzlePiece{public: virtualvoid draw()=0; virtualvoid rotate(int a_direction)=0; virtualbool isColliding(PuzzlePiece* p)=0; virtualint getType()=0;};What kind of game might this PuzzlePiece class fit in?dq 2Polymorphism (Graded)Can you give an example of where polymorphism would be used or where it would be useful?Are there any downsides to using polymorphism?Does anyone know how polymorphism (dynamic dispatch) can be done in pure C?How does dynamic_cast work? Are there any downsides to using dynamic_cast?DeVry GSP125 Week 6 Discussion 1 & 2 latest 2016dq 1Static Class Members (Graded)What special property does a static class member have? Is it shared among all objects of that class?What is the difference between a public static variable and a global variable?What is an exception? What are exceptions for?dq 2Inline Functions (Graded)What are inline functions designed to do? Discuss the difference between inline functions and regular functions.What is apreprocessor macro? Give an example.Consider the following code.#include
usingnamespace std;
inlineint addFunction(intconst& a,intconst& b)
return a+b;
#define addMacro(a, b)(a+b)
void main()
int sum;
sum= addFunction(5,12);
cout<< sum<< endl; sum= addMacro(5,12); cout<< sum<< endl; return0;}What is the difference between addFunction and addMacro? What is the difference in the compiler output?DeVry GSP125 Week 7 Discussion 1 & 2 latest 2016dq 1Templates (Graded)C++’s class templates provide a way to generate generic class declarations. What else do templates do that makes them powerful when building a class or function?Did you know that you can use the macro preprocessor to create template-like functionality? Does anyone have an idea how that could happen (ideally with an example)?Can you make a templated class in a header file, with its functions declared, and then define those functions in a .cpp file?What are some templated data structures from the Standard Template Library?dq 2Function Templates (Graded)Compare function overloading to a function template. What advantage does a function template provide?A big pro for templates is that you can have the compiler rewrite code for you with new types, which can save you a lot of time (once you’ve spent a large amount of time writing a class to work just how you want it). What are some cons of templates?Operating systems and other complex programs are often written in pure C, which does not have templates. In those situations, in which there are plenty of good reasons to have data structures that store different data types, how do you think a C programmer would do it without templates?

Order Solution Now

Similar Posts