In Python, can an object have another object as an attribute? For example, can a class called car have a class called tire as an attribute?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Do you mean a class
tireor an instance of classtire? It can have both although the latter is probably more useful. If you’re looking for an object of classMaryto has-a object of typeFredyou’d want theclassinstvariety of assignment: