This appendix covers a host of topics, including:
• A brief explanation of the uses and features of object-oriented programming
In an object-oriented view of programming, a program describes a system of objects inter-acting. This is contrary to a procedure-oriented view of programming, in which a program describes a series of steps to be performed.
Object-oriented programming involves a few key concepts. The most basic of these is abstraction, which simplifies writing large programs. Another is encapsulation, which makes it easier to change and maintain a program. The concept of class hierarchies is a powerful classification tool that can make a program easily extensible.
|What Is Object-Oriented Programming?|
All procedural languages support procedural abstraction, in which a piece of source code is put into a function and reused this way. For example, consider matrix multiplication:
ZeroMemory( pM, sizeof(D3DXMATRIX) );
for( WORD i=0; i<4; i++ )
for( WORD j=0; j<4; j++ )
for( WORD k=0; k<4; k++ )
pM[4*i+j] += pM1[4*i+k] * pM2[4*k+j];
memcpy( pOut, pM, sizeof(D3DXMATRIX) );