Our topic for the first journal is ‘Object-oriented programming’. After I saw this title, I asked myself that what is the Object-oriented programming? What I learned about Object-oriented programming in the lectures? What the Object-oriented programming do?
I do not want to talk about the definition of Object-oriented programming in my slog. I just want to describe my opinion about it.
First of all, personally, I think class is something contains the characteristics of an object. For example, there is a class Dog. It maybe contains the gender or the color of hair of dogs. What information the class contains depends on what I want it to contains.
For example, my class Dog is shown as follow:
Class Dog:
Def __init___(self)
Self.color = color
Self.gender = gender
There also can be some methods in the class. If you want a dog who is a girl dog, you can create a method to see if it is girl. It will be seems like this:
Def gender(self, gender):
Return self.gender == female
In my opinion, we can store the information in our class and create methods to do everything we want it to do with the given information.
No comments:
Post a Comment