C++ implementation on segment model

S

Stephen S M WONG

As C++ program supports objects with
constructors/destructors/methods and data items, I'll assume
C++ implementation on segment model computer, like a 80286
with different access restrictions on code segment / data
segment / etc., will force all objects to be resided in a
code segment, so that executable code can be there as well
as data. And effectively bypassing all segment model.

Any comments on the above?

Stephen Wong @ Hong Kong.
 
J

John Harrison

Stephen S M WONG said:
As C++ program supports objects with
constructors/destructors/methods and data items, I'll assume
C++ implementation on segment model computer, like a 80286
with different access restrictions on code segment / data
segment / etc., will force all objects to be resided in a
code segment, so that executable code can be there as well
as data. And effectively bypassing all segment model.

Any comments on the above?

Code is just code, and will always reside in the code segment. Data is just
data and will always reside in a data segment. You seem to think that
objects carry around little packets of code with them, but you are mistaken.

john
 
S

Stephen S M WONG

Then, on a segment model computer, methods will be
implemented by a table (virtual) placed in an object in a
data segment, and actual code is resided in code segment.
Am I right?

On a (pure) paging computer, methods (code) and data can be
intermingled in the user memory space. When an object with
inline methods is instantiated, the method code and data are
copied to a new memory location, that's my understanding of
method inheritance, anything wrong?

Stephen Wong @ Hong Kong.
 
J

John Harrison

Stephen S M WONG said:
Then, on a segment model computer, methods will be
implemented by a table (virtual) placed in an object in a
data segment, and actual code is resided in code segment.
Am I right?
Right.


On a (pure) paging computer, methods (code) and data can be
intermingled in the user memory space. When an object with
inline methods is instantiated, the method code and data are
copied to a new memory location, that's my understanding of
method inheritance, anything wrong?

Code is never copied. One copy of the code is sufficient for the whole
program.

As I said, you seem to think that objects carry code with them, this is not
the case. Perhaps you would be interested in a book called 'Inside the C++
Object Model' by Stanley Lippman. I bit out of date now, but still a good
book apparently (haven't read it myself).

john
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top