Skip to content

Latest commit

 

History

History
79 lines (60 loc) · 993 Bytes

class.md

File metadata and controls

79 lines (60 loc) · 993 Bytes

Class

It is blue print of object

Basic

Class Rectange {
  height:number;
  width:number;
  getArea : function()
  {
  }
}

javascript

 class Rectangle {
 
  //constructor
  constructor(height, width) {
    this.height = height;
    this.width = width;
  }
  
  getArea(){
    //calculate area
  }
}

//es5

function Rectangle(height, width){
   this.height = height;
   this.width = width;
   this.getArea = function(){
    //calculate area
  }
}

csharp

class Rectangle {

  private float height;
  
  private float width;
  
  //constructor
  public Rectangle(float height, float width) {
    this.height = height;
    this.width = width;
  }
  
  public float GetArea(){
    //calculate area
  }
}

python

class Rectangle:

    #constructor
    def __init__(self, height, width):
        self.height = height
        self.width = width

    def getArea(this):
        #calculate area
        area=0
        return area