Showing posts with label class. Show all posts
Showing posts with label class. Show all posts

Tuesday, August 4, 2015

Module Creation

This is an example of a module. Modules are meant to be imported into another program and used, not run stand alone.



Wednesday, June 17, 2015

Sunday, June 14, 2015

Creating and Accessing Attributes

The constructor method in this program has the attribute of name. The __str__() method creates a string representation of the object. See different ways to access attributes in the program below.



Creating Class, Method, and Objects

This simple program creates a class (virtual_pet), object (pet1), method (talk).

Monday, October 13, 2014

Constructors

A constructor is a function that initializes immediately as soon as the objects is created. See example below.


Update to Market Evaluation Program

An update to the Stock Market Evaluation Program that utilizes Classes and Objects to give some additional information in the form of Strings based on user inputs.


Saturday, October 4, 2014

Classes and Self

Self is used as temporary placeholder for the object. See two examples below.



Thursday, October 2, 2014

Object Oriented Programming

An object contains built in attributes. These attributes can be data and/or methods. Functions associated with an object are referred to as methods. 

Before an object can be created, a class must be created. A class is a blueprint for an object.
Many objects can refer to the same class.

See below for two examples of creating a class, and then creating an object.