How can you use a class 1's method in another class 2. Class 2 does not inherit class 1.
cruze098 0
Newbie Poster
Recommended Answers
Jump to PostOne way to use class 1's methods in class 2 is to have a class 2 object aggregate a class 1 instance. It is a standard pattern in OOP, called composition, which is often used as an alternative to inheritance
class Class1(object): def method(self): print(self) class Class2(object): …
All 4 Replies
krystosan 0
Junior Poster
TrustyTony 888
pyMod Team Colleague Featured Poster
syed2011 0
Newbie Poster
Gribouillis 1,391
Programming Explorer Team Colleague
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.