"andy" <an******@hotmail.comwrote:
A question about about passing a class by reference:
You don't pass a class by reference, you pass objects by reference.
Say you have a class called car, and within that you have two objects
called car01 and car02.
What type is car01 and car02? If they are cars then they likely
shouldn't be "within" the class.
Within the class I have an int variable called wheels.
I have declared the following:
int number_of_wheels( const car &new_wheels)
Where did you declare it? Is it within the car class?
Now how do I within this function access the variables 'wheels' of
object car01 ?
You seem to have a fundamental misunderstanding as to what a "class" is
and what an "object" is. If you go to your kitchen and pick up three
fruits, you will have three objects in your hand, each will be unique.
You would never say they are "within" the concept "fruit", they are
manifestations of that concept. One of the properties of a fruit is it
contains seeds. I.E., the seeds are within the fruit.
I think you should read more about these concepts before you start
coding.
Good luck!
--
To send me email, put "sheltie" in the subject.