keep in mind that these all are one question solve this question on a paper and
ID: 3816090 • Letter: K
Question
keep in mind that these all are one question solve this question on a paper and or electronically if you dont answer them all dont even bother to answer one of them.
here is the question
Section 13: Classes and objects (Thursday, April 13) Exercises: Solve the following three (3) Self-Check problems on paper and bring your sheet of paper to your section on Thursday 1. What is an object? Answer the question in your own words 2. The constructor in the following class definition has two major problems. What are they? Describe the issues, and write a working version of the constructor class Point The constructor: def init initia. x, int initial y) X initial x Y initial yExplanation / Answer
1)Objects are key to understanding object oriented terminology.
->Generally objects related to real world entity.
->real world entity we consider as object.for which we can say state as well as behaviour
->consider human as object which have state like height,weight,colour etc.
->behaviour like talking,walking etc.
in our programming language we can define object as instance of class: for suppose i defined human as class
then take one instance of that human class i.e,you or someone.which give all information regarding you or someone.
->Here states like data members,behaviour like methods .
2)in given example : 1)arguments passing :we must include 'self' as one argument.
2)variable definition in constructors
def _init_(self,initial_x,initial_y):
self.x=initial_x
self.y=initial_y
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.