Python Forum
New to python, i would like to know what a class is ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New to python, i would like to know what a class is ?
#1
Hi my name is Paul and I've been using Python about a week. Kind of getting to grips with it and making progress . Upto now and for the last 16 months I've been using AGK2 and have had some success with it and produced a few games . One thing which I don't understand is the class thing . What is it and how does it work in a nice simple to understand explanation please . thanks.
Reply
#2
check our tutorial on class basics
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
The "class thing" is whole concept for programming languages.
Other concepts: imperative, declarative, functional
With a class you define a behavior of an object. A class is like a construction plan for objects.

A class instantiates an object and the object follows the rules of the class.
The object has attributes and methods. You can read and write the attributes.
A method should do something with the object.

The other very important topic is inheritance.
If you have a general class for Bricks, you can inherit from the Bricks class and make Special_Bricks.
The class Special_Bricks inherits all methods and attributes from the Bricks class.
Additional features and properties are added to the Special_Bricks class.
If you change the Bricks class, the Special_Bricks class is also affected.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#4
Ok thanks for the reply it took me a while to get my head around arrays too. I get the inheritance thing at least. I'll probably understand it more and where to use it as I go further into it. I've spent the last 16 months learning AGK2 but decided I wanted to learn a professional language so here I am . I've only ever used BASIC so oop is a new concept to me . So far so good really liking Python.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020