Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
What are proxy objects? C++
What are proxy objects? C++
✍: Guest
Objects that stand for other objects are called proxy objects or surrogates.
template <class t="">
class Array2D
{
public:
class Array1D
{
public:
T& operator[] (int index);
const T& operator[] (int index)const;
};
Array1D operator[] (int index);
const Array1D operator[] (int index) const;
};
The following then becomes legal:
Array2D<float>data(10,20);
cout<<data[3][6]; // fine
Here data[3] yields an Array1D object
and the operator [] invocation on that object yields the float in
position(3,6) of the original two dimensional array. Clients of the
Array2D class need not be aware of the presence of the Array1D class.
Objects of this latter class stand for one-dimensional array objects
that, conceptually, do not exist for clients of Array2D. Such clients
program as if they were using real, live, two-dimensional arrays. Each
Array1D object stands for a one-dimensional array that is absent from a
conceptual model used by the clients of Array2D. In the above example,
Array1D is a proxy class. Its instances stand for one-dimensional
arrays that, conceptually, do not exist.
2012-01-12, 2719👍, 0💬
Popular Posts:
Would I use print "$a dollars" or "{$a} dollars" to print out the amount of dollars in this example?...
How To Add Column Headers to a Table? - XHTML 1.0 Tutorials - Understanding Tables and Table Cells I...
How To Use an Array as a Queue? - PHP Script Tips - PHP Built-in Functions for Arrays A queue is a s...
What Articles Have You Read about JUnit? There are a number of JUnit articles that you should read: ...
What are the different accessibility levels defined in .NET ? Following are the five levels of acces...