Test 2 Flashcards
In C++ what is the difference between a struct and a class?
the deaufult access specifier
What is the primary valve in using virtual functions within C++?
They allow you to provide unique behavior for derived classes
What is the point in making a destructor “virtual”?
It causes the derived class destructor to be called upon delete
Which statement is true of “pure virtul” functions?
a) They force you to derive another class from the base class which contains function.
b) They contain no code
Both of these
If two functions within the same classhave the same name what happens?
either one will be called depending on the parameters
What is wrong whit the following? struct Svalues (char x .....x = 25 y = 30 class C values (...) x = 25 y = 30
Private members of a class are being accessed by other than a member/ friend function.
Is the following class definition correct?
class point { int x,y; void point(): void point (int n, int m); };
It is not correct, construction can not return any value
Suppose that we declare an array int ARR [10] and perform the following instruction ARR[10]=10.7. What is the value stored in the 10th array element?
We can not predict
Consider the following class definition. Which of the presented definitions is correct?
class point {int x; const int y; public: point (int n, int m);};
y (m) {x = n}
consider the following class definition
class A {public: int x; const int y; static int z; A(int xx, int yy, int zz); }; Is this correct? A(int xx, int yy, int zz) : y(yy), z(zz) {x=xx}
No, static members can not be initialized at initialization list.
Consider the following class sequence. Determine type of acces to member x1,x2,y1,y2
class x1 {intx1; public: int y1; };....
x1,x2,y2-private, y1 - public
Consider the following coder frgment. Which exception handler will be used ?
try {int number 7;
throw number;}
catch (const int a) {first}….
First
The following class template has been defined: template which of the defined below template class is correct
test ob1;
The following function has been definied void test(int y, float z =6.55,intk,inti=0) which of the specified below function calls is correct?
No correct answer
Consider the following code fragment. Determine the valuesof members “x”and “y” for object “begin”
no correct answer