How do you connect two classes without using inheritance.
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
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.