[Tutor] how to instantiate a class

Arun Tomar tomar.arun at gmail.com
Thu Feb 26 08:25:43 CET 2009


@Abhishek,

On 2/26/09, Abhishek Kumar <abhishek.luck at gmail.com> wrote:
> hello list,
>
> Below is the sample code of a class.
>
>
> import <someStandardModule>
>
> Class ABC:
>              def __init__(self,a,b,c):
>                                 statement 1
>                                  statement 2
>              def func(x,y):
>                            statement 1
>                            statement 2
>
> Here is the question:
>
> how to make an object of this class and how to use the methods listed
> in the class.

you can make object

newobj = ABC()

using the methods would be

newobj.func()

> do i need to create the object in a separate file or in the same file
> it can be done ??

It's upto you. You can create the object in the same file or separate
file, both works.

kindly read the documentation, especially the tutorial section. It's
one of the best available resources for learning python.

http://docs.python.org/

> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>


-- 
Regards,
Arun Tomar
blog: http://linuxguy.in
website: http://www.solutionenterprises.co.in


More information about the Tutor mailing list