🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by sher@sunybcs.uuc Thu, 09 Mar 1989 18:53
Why no virtual data?
#2738
Author: sher@sunybcs.uuc
Date: Thu, 09 Mar 1989 18:53
31 lines
1212 bytes
Is there any reason why functions can be virtual but not data objects
(the implementation of a virtual data object is exactly analogous to that
of a virtual function).  Here's the application:
I have a matrix package with two types of matrices and vectors.
A vector is the base class is what you'd expect.
A spaced vector is a vector which is not contiguous in memory but is
every nth element where n is given.
Similarly I have matrix and spaced matrix.  So a row of a matrix is
a vector.  Thus I can define
class matrix {...
 virtual vector *rows;  //  the rows of the matrix
 ...
};

I also want to say:
class spaced_matrix {...
 virtual spaced_vector *rows;
 ...
}

Currently c++ does not support this but I would think that this would
increase the orthogonality of the language, the efficiency of implementing
things like this (which would seem to be a fairly common effect the
elements of a complex subclass would be sub classes) and generally
a trivial to implement improvement.  Adding it would not break anything
I can imagine and in fact should simplify the compiler considerably.
-David Sher
-David Sher
ARPA: sher@cs.buffalo.edu	BITNET: sher@sunybcs
UUCP: {rutgers,ames,boulder,decvax}!sunybcs!sher
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads