How to define a property?

W

wiza

if i want to implement the point type in terms of pair<int ,int>, and i
also want to define a member variable named x to access the
pair<int,int>::first member variable.

how can i achiev this goal?i dont want to use memeber function.
 
E

E. Robert Tisdale

wiza said:
If I want to implement the point type in terms of pair<int ,int>
and I also want to define a member variable named x
to access the pair<int,int>::first member variable.

How can I achieve this goal?

I dont want to use member function.

We are happy to help you with your homework
provided that you make an attempt yourself first.
Please post the code that you have written so far
and I'm sure you'll get lots of help.
 
C

cyrusNew

U¿ytkownik "wiza said:
if i want to implement the point type in terms of pair<int ,int>, and i
also want to define a member variable named x to access the
pair<int,int>::first member variable.

how can i achiev this goal?i dont want to use memeber function.

you want C# like properties ?
 
C

cyrusNew

U¿ytkownik "cyrusNew said:
you want C# like properties ?

you might make x a class with operator=, and put there all necessery logic.
If thats your HW then this should suffice:)
 

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

No members online now.

Forum statistics

Threads
474,197
Messages
2,571,040
Members
47,634
Latest member
RonnyBoelk

Latest Threads

Top