QuestionQ77Verified/Object-Oriented ProgrammingCopy linkReport a problemAsk AstroTutorSave questionAssuming the following code has executed successfully, which expressions evaluate to True? Choose twoAA.VarA == 1Bisinstance(obj_b,A)CB.VarA == 1Dobj_a is obj_aaShow AnswerAnswerExplanationA.VarA retains the value 1. B is a subclass of A, so an instance of B is also considered an instance of A by isinstance(). B.VarA overrides the inherited value with 2, and two separate calls to A() create distinct objects, so they are not identical under is.Learn morePython documentation: Classes and inheritancePython documentation: Object identity and the is operatorShow comments1Show commentsCommunity DiscussionNo comments yet. Be the first to start the discussion!
Community Discussion