customer1.setExcursion1() = cust_dest.get_excursion1();
customer1
and cust_dest
are two different objects from two different classes.
Can I pass the return value of
cust_dest.get_excursion1();
to the
my customer1.setExcursion1()
method?
Yes, you can - but not like that. You call the setter method, passing in the value as an argument - you're currently trying to assign a value to the method call, which makes no sense.
You want:
customer1.setExcursion1(cust_dest.get_excursion1());
(Your naming is inconsistent, by the way. It should be getExcursion1
, at least - and ideally just getExcursion
. What is the 1
meant to be for? Likewise cust_dest
should be custDest
if you're not changing the words - or ideally something rather more descriptive.)
See more on this question at Stackoverflow