Quiz Questions

For

2/22/2001

 

 

Assume

 

CBase is a base class

CDerived class derived from CBase

i is an integer

p’s and q’s on different lines are not necessarily related.

 

Be prepared to describe the following:

 

1.     int *p;

2.     int *p = new int(10);

3.     int *q = new int[10];

 

4.     delete p;

5.     delete []q;

 

6.     int *p = &i;

7.     int foobar(const Node *arg)(

8.     int foobar(const Node *&arg)

9.     int foobar(const Node *&arg) const

10. const int foobar(const Node *&arg)

11. bool operator==(Node arg)

12. bool operator==(Node *arg)

 

13. virtual bool operator>(CBase &)=0;

14. virtual bool operator>(CBase &RHS);

15. {  if ( Data > ((CDerived &)RHS).Data )  }

16. {  if ( Data > ((CDerived *)&RHS)->Data) }

17. if( *p == *q )

 

18. class D : public B { ...

19. class D : private B { ...