How do you connect two classes without using inheritance.
david_25 0 Newbie Poster
Recommended Answers
Jump to Post
By each having a reference to the other. Eg your Car class is connected to your Person class via the driver variable. Inheritance is also called an "is a" relationship (Cat is a Mammal). You can also have a "has a" relationship (Car has a Driver)
When the hasDriver method …
All 4 Replies
david_25 0 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
ObSys 56 Junior Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.