Saturday, 23 March 2013

What is a Class and Object??

A class is a template or blueprint from which objects are created.. Example of a class: Cars, Employee, Shapes etc.

class class-Name
//variables /methods/constructors

Relationship between Classes:
Classes share 3 types of relationship between each other. 
  • Dependance(uses-a)
  • Aggregation(has-a)
  • Inheritance(is-a)

An object is an instance of a class. The relationship is such that many objects can be created using one class. Each object has its own data but its underlying structure (i.e., the type of data it stores, its behaviors) are defined by the class.

Tags: ,,

No comments:

Post a Comment