help please! Short Answer. For C++: What is the difference between a C++ class a
ID: 3824205 • Letter: H
Question
help please!
Short Answer. For C++:
What is the difference between a C++ class and a C++ object?
What is the difference between a public and private member of a class?
Why are data members (variables) almost always private?
For file io, what does ios::out mean?
Why should we primarily use the “string” object instead of “const char *” strings? (give one specific reason)
Why should we primarily use the “array” object instead of “int bob[20]” arrays? (give one specific reason)
What is one of the things you can do to debug your code in a project?
If we write the code for a member function of a class (for example, shuffle, a member of Deck class) in a .cpp file, why do we have to reference the class name (eg, Deck::shuffle() instead of just shuffle() )?
Explanation / Answer
What is the difference between a C++ class and a C++ object?
SOLUTION: classese and objects are related but different.object is an instance of the class and every object belongs to a class and every class is containing one ore more objeccts.class3es are static and its attributes are fixed pre and post execution of a program,and attributes wont chanmge.whereas objects are created and eventually destroyed.
What is the difference between a public and private member of a class?
the main difference between the public and private member of a class are
public data menbers are itsmember functions have access outside the class,whereas private data menbers and its data functuions are cannot be accessed outside the class.
Why are data members (variables) almost always private?
the private members can only have access from inside the same class,, so if anything goes wrong with that , we have usually only one source file to look at that. but in the case of huge code it kept your classes are small, and helps in reduce reduce your bug track efforts.
For file io, what does ios::out mean?
ios::out means "Open for the output operations".
Why should we primarily use the “string” object instead of “const char *” strings? (give one specific reason)
the main reason to use string object is for operator overloading
Why should we primarily use the “array” object instead of “int bob[20]” arrays? (give one specific reason)
as we know that that objects are pointers,,we can have both variable referencing an object, or variable referencing a pointer to the object.
.thats y we used object array
students **students = new (students*)[1]; // Create an array of student pointers
students[0] = new student(studentWidth, studentHeight, 20, 1); // Create a single student
What is one of the things you can do to debug your code in a project?
If the program runs without any crashing, then it is the miscomputing thing bbut running successfully. here The basic technique in this first situation is to use the debugger to watch the program do its work, by stepping though the program one statement at a time.debugging tasks are much easier and less time-consumed.we will go for debugging mainy to check the function behave correctly and if this condition was true.
If we write the code for a member function of a class (for example, shuffle, a member of Deck class) in a .cpp file, why do we have to reference the class name (eg, Deck::shuffle() instead of just shuffle() )?
Deck::shuffle() means shuffle the deck that you just initalized.
shuffle() means it shuffles the cards in the desk and randomly rearranges pointers
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.