classicalInheritance.js
上传用户:shen332233
上传日期:2021-09-03
资源大小:7478k
文件大小:1k
源码类别:

Ajax

开发平台:

Java

  1. function Vehicle() {
  2.     var wheelCount = 4;
  3.     var curbWeightInPounds = 4000;
  4.     this.getWheelCount = function() {
  5.         return wheelCount;
  6.     }
  7.     this.setWheelCount = function(count) {
  8.         wheelCount = count;
  9.     }
  10.     this.getCurbWeightInPounds = function() {
  11.         return curbWeightInPounds;
  12.     }
  13.     this.setCurbWeightInPounds = function(weight) {
  14.         curbWeightInPounds = weight;
  15.     }
  16.     this.refuel = function() {
  17.         return "Refueling Vehicle with regular 87 octane gasoline";
  18.     }
  19.     this.mainTasks = function() {
  20.         return "Driving to work, school, and the grocery store";
  21.     }
  22. }
  23. function SportsCar() {
  24.     this.refuel = function() {
  25.         return "Refueling SportsCar with premium 94 octane gasoline";
  26.     }
  27.     this.mainTasks = function() {
  28.         return "Spirited driving, looking good, driving to the beach";
  29.     }
  30. }
  31. function CementTruck() {
  32.     this.refuel = function() {
  33.         return "Refueling CementTruck with diesel fuel";
  34.     }
  35.     this.mainTasks = function() {
  36.         return "Arrive at construction site, extend boom, deliver cement";
  37.     }
  38. }