201871010116- Qi British Red "object-oriented programming (java)" fourth week of learning summary

Bowen beginning of the text format: (2 points)

project

content

"Object-oriented programming (java)"

https://www.cnblogs.com/nwnu-daizh/

Where this requirement in the job

https://www.cnblogs.com/nwnu-daizh/p/11552848.html

Job learning objectives

  1. Master the basic concepts of classes and objects, understand the relationship between classes and objects;
  2. Grasp the relationship between the object and the object variable;
  3. Master the common API predefined classes Date, LocalDate class;
  4. User-defined master the rules of grammar class, including instance fields, static fields, constructor method, change the filter method, accessor methods, static methods, main method, the method requires the definition of parameters; (major and difficult)
  5. Grasp the object constructor, define methods and requirements; (focus);
  6. Overloaded understand the concept and usage;
  7. Grasp the concept and usage of the package;

Essay Bowen body content include:

Part I: Chapter IV summarizes theoretical knowledge (20 points)

   Programming Object-Oriented Programming Overview: Programming Object-Oriented Programming (OOP) is the mainstream of today's programming paradigm; Object-oriented programming is composed of objects, each object comprising a function part and a specific part of the user to realize hidden disclosed program many of objects from the standard library, there are some custom generally provide classes, encapsulation, inheritance syntax and concepts to assist our object-oriented programming. In the process-oriented programming, data and operations on the data are separated, so this approach needs to pass data to the procedures and functions; and object-oriented programming and the data belonging to their operation into the same data structure, data and operations all in one unified body, so to solve the many problems facing the inevitable process of program design. The so-called object-oriented program is our modular, object-oriented, the characteristic properties of specific things and specific methods to achieve some action by these properties into a single class.

1. The three characteristics of object oriented encapsulation, inheritance, polymorphism.

  Encapsulation: and behavior data is combined in a package, and the user hides the implementation of the object data, the key to the package so that the method can not directly access the other class instance of the class field.

            Examples of data objects called domain, the process is called method of manipulating data, for each specific instance of a class has a set threshold specific example, the current state of this object is a collection of values.

  Inheritance: to create a class of another process by extending a class in Java, all classes are derived from the object. When extending an existing category, the new class after having extended all the attributes and methods of the expanded classes.

2. The three characteristics of object: the behavior of objects, state objects, object identity.

   The relationship between classes and objects: class is a template object, the object is an instance of a class, the class can only be used by the object.

   Relationships between classes: dependent, polymerization, inheritance.

   Composition class: properties, methods,

3. Use predefined classes: To use the object, the object must first be constructed, and specify its initial state. Constructor is a special method, to construct and initialize the object, the constructor's name should be the same class name,

   Generating object format: name = new class name of the object class name ().

  If an object is not instantiated and used directly, a null pointer exception occurs during use.

4.Java class library LocaiDate (calendar notation) Class: Once you have a LocalDate object, you can use the method getYear, getMonthValue, getDayOfMonth get year, month, day. Get a new object with the LocalDate plusDays method.

The user-defined classes: Employee class used, a plurality of source files,

  Starting constructor: constructor and other methods are an important difference, is always accompanied by the implementation of the constructor new operator is called, but not for an existing call to the constructor of the object to achieve the purpose of resetting the instance fields . Constructor and named classes, each class can have more than one configuration, a configuration may have 1, 0 or more of the above parameters, the constructor does not return a value, always accompanied by the constructor called with the new operator.

  The method may be configured with the same name as the attribute class initialization, class constructor, no return value type declaration, if there is no clear definition of a class in the constructor, a constructor with no arguments is generated, in a class constructor can be overloaded, but each has at least one class constructor.

  (Implicit) and implicit parameter (Explicit) parameters explicitly specified: the operation target and an access domain examples thereof, Implicit parameters appear in front of the method name Employee class object, explicit parameter value located in parentheses following the name of the method, obviously column in the method declaration, in each method, the keyword this represents an implicit parameter, use the keyword in Java, this may represent the current object, "this. properties" the properties of this class can be invoked through "this. method "this class can call other methods; may call the constructor for this class by this () form, but requires on the first line constructor when calling. .

The advantages of the package: the internal implementation can be varied, in addition to the methods of the class, i does not affect the other code. Changing methods that can perform error checking, but direct assignment of the domain will not be these processes.

  Private Methods: In order to implement a private method, simply change the public keyword private. Encapsulation class: through the private key modification, the property can not be transferred directly call external, and can only be done by a getter or setter method, as long as the property must be packaged.

6. belonging to class reference data types, passed by reference, the usage rights transfer heap memory.

7.final instance fields: Example domain may be defined as a final, this field must be initialized when the object is constructed, final applied field modifier most basic type field or immutable class. added before final data member variable, such that the variable becomes a constant, and therefore do not modify the program code. Public static final use may declare a global constant.

8. The static fields, and static methods:

  Static fields (nextID): Static Domain cup called class field.

  Static constant: Example PI = 3.14

  Calling this method can omit the keyword static, you need to use the Employee class object reference: static methods.

  Factory methods, main method.

9. Object structure:

  String special class in Java, String replication may be used directly, can also be instantiated by construction methods, the former refers to one instance of the object, and this object instance can be reused, which will produce two objects instantiated wherein a space is spam, in comparison with the content in the equals method string, and "==" is an address value of the two comparison strings. Once declared the contents of the string can not be changed.

  Declared static properties and methods can be called directly by the class name, static attributes are shared by all objects, you can manipulate it on.

  If you need to limit the production of the class object, the method of construction may be privatized.

  Use an array of objects to be divided declare the array as an array of open space and two-step. After opening up space for the contents of each element in the array is null.

10. Package:

  Class import:

  Internal class is defined inside a class of another class, inner class easy operation of the external access private class. Parameter access methods inside the class in order to declare a method, you must add the parameter before the final keyword.

  Inheritance can extend an existing class of functions realized by the extends keyword, you can inherit the parent class members to subclasses. Java constructor executed before the subclass will first call the no-argument constructor of the parent class, its purpose is to inherit from the parent class members to do the initialization. When the parent class has multiple constructors, such as the method to be invoked by a particular configuration of the super subclass constructor () that keyword.

  this () method is used to invoke other configurations within the same class, super () is used to call the parent class constructor from a constructor subclass. This class will now look for when using this call properties and methods, if not then find from the parent class of this class, the use of super will need to find the properties and methods from the parent class. this () and super () are similar in that: when the constructor overload, both of which will correspond to the constructor is executed correctly according to the number and type of parameters given; both of which must be written in the constructor the first line, it is precisely for this reason, this () and super () can not exist simultaneously in the same constructor.

  Overload (Overloading) refers to the number of parameters or the same name but different types of methods are defined in the same class, therefore, Java can be based on the number or type of the corresponding parameter of the method call.

  Rewriting (overriding) is defined name, number and type of parameters are the same parent class method in a subclass among the methods used to override the parent class.

  If a parent class does not want to quilt class override, can be added before the final keyword in the parent class.

  All classes inherit from the Object class. A good class should override the Object class toString (), equals (), hashCode () 3 th method, all of the objects may be in transition up to the Object class

  An abstract class can not be directly used to generate the object must be instantiated object operated by polymorphism. The method of abstract class is divided into two types, one is a general method, the other is abstract method begins with the abstract keyword. Abstract method does not define method body, but you want to keep to derive from the abstract class to define a new class.

  The interface is a collection of methods and global constants, the interface must be implemented by a subclass, an interface can inherit multiple interfaces at the same time, a subclass can implement multiple interfaces simultaneously. 

  Java does not allow multiple inheritance classes, but allows multiple interfaces.

  Polymorphism Java object into upward transition (automatic) and the downward transition (mandatory).

  By instanceof keyword can determine the object belongs to which class.

  The role of anonymous inner classes are available to create an inner class object does not have a name, and use it to access class members

  The classes in the package:

  Use the package keyword in Java to be a class into a package.

  Use the import statement in Java can import an existing package.

  Java in the access control rights are divided into four kinds, namely private, default, protected, public.

Part II: Experimental part

Experiment name: the definition and use of three types of experiments with the object

1. Purpose:

(1) familiar with the PTA platform for online testing environment;

(2) The user-defined appreciated class;

(3) grasp the object declaration;

(4) to learn to use a constructor initializes the object;

(5) using the class attributes and methods of using the master;

(6) to master the use of package and import statements.

3. Experimental procedure and content:

Experiment 1 Task 1 (10 points)

  Code is as follows:

import java.util.Scanner;
 
public class Shen {
 
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner in = new Scanner(System.in);
        System.out.println("please input your ID:");
        String s1 = in.nextLine();
        String s2,s3,s4;
        s2 = s1.substring(6, 10);
        s3 =s1.substring(10, 12);
        s4 = s1.substring(12, 14);
        System.out.println(s2+"-"+s3+"-"+s4);
 
    }
 
}

  FIG run results were as follows:

Experiment 1 Task 2 (25 points)

  Code is as follows:

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	// private static Student students[];

	private static ArrayList<Student> list;

	public static void main(String[] args) {
		list = new ArrayList<>();
		Scanner in = new Scanner(System.in);
		try {
			readFile("studentfile.txt");
			System.out.println("请选择操作,1按姓名,2按学号,3退出");
			int i;
			while ((i = in.nextInt()) != 3) {
				switch (i) {
				case 1:
					System.out.println("请输入姓名");
					String name = in.next();
					Student = findStudentByName Student (name); 
					IF (Student == null) { 
						System.out.println ( "not found"); 
					} the else { 
						System.out.println (student.toString ()); 
					} 
					System.out.println ( "Please select operation, one by name, by Student No. 2, 3 exit"); 
					BREAK; 
				Case 2: 
					System.out.println ( "Please enter the student number"); 
					String ID = in.next (); 
					Student student1 findStudentById = (ID); 
					IF (student1 == null) { 
						System.out.println ( "not found"); 
					} the else { 
						System.out.println (student1.toString ()); 

					} 
					System.out.println ( " select an action, one by name, student number by 2, 3 exit "); 
					BREAK; 

				default:
					System.out.println ( "input error"); 
					System.out.println ( "Please select the operation according to a name, by Student No. 2, 3 Exit"); 
					BREAK; 
				} 

			} 
		} the catch (IOException E) { 
			/ / catch block TODO automatically generated 
			e.printStackTrace (); 
		} {the finally 
			in.close (); 
		} 

	} 

	public static void readFile (String path) throws IOException { 
		the FileReader Reader the FileReader new new = (path); 
		the BufferedReader br = new new the BufferedReader ( Reader); 
		String Result; 
		! the while ((Result = br.readLine ()) = null) { 
			Student Student Student new new = (); 
			student.setName (result.substring (13 is)); 
			student.setID (result.substring ( 0,12)); 
			List.add (Student);
		}
		br.close();
	}

	public static Student findStudentByName(String name) {
		for (Student student : list) {
			if (student.getName().equals(name)) {
				return student;
			}
		}
		return null;

	}

	public static Student findStudentById(String Id) {
		for (Student student : list) {
			if (student.getID().equals(Id)) {
				return student;
			}
		}
		return null;

	}
}

class Student {
	private String name;
	private String ID;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getID() {
		return ID;
	}

	public void setID(String iD) {
		ID = iD;
	}

	@Override
	public String toString() {
		// TODO 自动生成的方法存根
		return "Name is:" + name + "Science number is:" ID +; 
	} 
}

  FIG results are as follows:

Experiment 2 Test Procedure 1 (10 min)

 (1) code is as follows:

import java.time.*;


/**
 * This program tests the Employee class.
 * @version 1.13 2018-04-10
 * @author Cay Horstmann
 */
public class EmployeeTest
{
   public static void main(String[] args)
   {
      //构造一个Employee数组,并填入三个雇员对象
      Employee[] staff = new Employee[3];

      staff[0] = new Employee("Carl Cracker", 75000, 1987, 12, 15);
      staff[1] = new Employee("Harry Hacker", 50000, 1989, 10, 1);
      staff[2] = new Employee("Tony Tester", 40000, 1990, 3, 15);

      // 用Employee类的raiseSalary方法将每个雇员的薪水提高5%
      for (Employee e : staff)
         e.raiseSalary(5);

      // 调用getName方法、getSalary方法和getHireDay方法将每一个雇员的信息打印出来
      for (Employee e : staff)
         System.out.println("name=" + e.getName() + ",salary=" + e.getSalary() + ",hireDay=" 
            + e.getHireDay());
   }
}


class Employee
{
   private String name;         //实例域定义
   private double salary;
   private LocalDate hireDay;

  
   public Employee(String n, double s, int year, int month, int day)     //构造器定义
   {
      name = n;
      salary = s;
      hireDay = LocalDate.of(year, month, day);
   }

   public String getName()        //实例域name的访问器方法     
   {
      return name;                  
   }

   public double getSalary()          //实例域salary的访问器方法
   {
      return salary;               
   }

   public LocalDate getHireDay()          //实例域HireDay的访问器方法
   {
      return hireDay;               
   }

   //调用raiseSalary方法的对象的salary实例域设置为新值
   public void raiseSalary(double byPercent)
   {
      double raise = salary * byPercent / 100;
      salary += raise;
   }
}

  

  运行结果如下图:

  (2) 

   EmployeeTest.java程序代码如下:

 
  public class EmployeeTest
 {
    public static void main(String[] args)
     {
        // 用三个employee对象填充staff数组
        Employee[] staff = new Employee[3];     
 
      staff[0] = new Employee("Carl Cracker", 75000, 1987, 12, 15);
       staff[1] = new Employee("Harry Hacker", 50000, 1989, 10, 1);
       staff[2] = new Employee("Tony Tester", 40000, 1990, 3, 15);

       // raise everyone's salary by 5%    给每人涨5%的工资
       for (Employee e : staff)     //进行foreach循环
          e.raiseSalary(5);
 
       // print out information about all Employee objects
       for (Employee e : staff)
          System.out.println("name=" + e.getName() + ",salary=" + e.getSalary() + ",hireDay=" 
             + e.getHireDay());
    }
 }

  运行结果如下图:

    Employee.java程序代码如下:

 import java.time.LocalDate; 
  
  public class Employee {
      
  
 
   private String name;   //实例域定义
     private double salary;  //实例域定义
    private LocalDate hireDay;  //实例域定义
 
    public Employee(String n, double s, int year, int month, int day)     //构造器的定义
    {
       name = n;
       salary = s;
       hireDay = LocalDate.of(year, month, day);
    }
 
    public String getName()    //实例域name的访问器方法
    {
       return name;
    }
 
    public double getSalary()  //实例域Salary的访问器方法
    {
    	return salary;
    }
 
    public LocalDate getHireDay()  ////实例域HireDay的访问器方法
    {
       return hireDay;
    }
 
    public void raiseSalary(double byPercent)   
    {
       double raise = salary * byPercent / 100;
       salary += raise;
    }
 }

  运行结果如下图:

  (3)程序代码如下:

 import java.util.Scanner;
  
  public class student {
      String name;
      String sex;
      double javascore;
      public static void main(String[] args) {
          System.out.println("请输入学生人数");
          Scanner su = new Scanner(System.in);
         int totalStudent = su.nextInt();
         student[] stus= new student[totalStudent];
         for(int i=0;i<totalStudent;i++) {
             student s =new student();
             stus[i]=s;
             System.out.println("请输入第+“i"+"个学生的姓名");
             s.name = su.next();
             System.out.println("请输入第+“i"+"个学生的性别");
             s.sex = su.next();
             System.out.println("请输入第+“i"+"个学生的java成绩");
             s.javascore = su.nextDouble();
         
         }
         printstudent(stus);
         su.close();
     }
 
     public static void printstudent(student[] s) {
         System.out.println("姓名\t性别\tjava成绩");
         for(int i=0;i<s.length;i++) {
             System.out.println(s[i].name+"\t"+s[i].sex+"\t"+s[i].javascore);
          }
     }
 }

  运行结果如下图:

 

实验2  测试程序2(5分)

  程序代码如下:

/**
 * This program demonstrates static methods.
 * @version 1.02 2008-04-10
 * @author Cay Horstmann
 */
public class StaticTest
{
   public static void main(String[] args)
   {
      // fill the staff array with three Employee objects
      var staff = new Employee[3];            //构造了一个Employee 数组,并填入三个雇员对象

      staff[0] = new Employee("Tom", 40000);
      staff[1] = new Employee("Dick", 60000);
      staff[2] = new Employee("Harry", 65000);

      // print out information about all Employee objects
      for (Employee e : staff)               //调用getName 方法,getId方法和getSalary方法将每个雇员的信息打印出来
      {
         e.setId();
         System.out.println("name=" + e.getName() + ",id=" + e.getId() + ",salary="
            + e.getSalary());
      }

      int n = Employee.getNextId(); // calls static method
      System.out.println("Next available id=" + n);
   }
}

class Employee
{
   private static int nextId = 1;

   private String name;               //实例域定义
   private double salary;
   private int id;

   public Employee(String n, double s)            //构造器定义
   {
      name = n;
      salary = s;
      id = 0;
   }

   public String getName()                //实例域name的访问器方法
   {
      return name;
   }

   public double getSalary()              //实例域salary的访问器方法
   {
      return salary;
   }

   public int getId()                 //实例域id的访问器方法
   {
      return id;
   }

   public void setId()
   {
      id = nextId; // set id to next available id
      nextId++;
   }

   public static int getNextId()          //实例域NextId的访问方法
   {
      return nextId; // returns static field
   }

   public static void main(String[] args) // unit test
   {
      var e = new Employee("Harry", 50000);
      System.out.println(e.getName() + " " + e.getSalary());
   }
}

  运行结果如下图:

实验2  测试程序3(5分)

  程序代码如下:

/**
 * This program demonstrates parameter passing in Java.
 * @version 1.01 2018-04-10
 * @author Cay Horstmann
 */
public class ParamTest
{
   public static void main(String[] args)
   {
      /*
       * Test 1: Methods can't modify numeric parameters(方法不能修改数值参数)
       */
      System.out.println("Testing tripleValue:");
      double percent = 10;
      System.out.println("Before: percent=" + percent);
      tripleValue(percent);     //调用方法tripleSalary
      System.out.println("After: percent=" + percent);

      /*
       * Test 2: Methods can change the state of object parameters (方法可以更改对象参数的状态)
       */
      System.out.println("\nTesting tripleSalary:");
      var harry = new Employee("Harry", 50000);
      System.out.println("Before: salary=" + harry.getSalary());
      tripleSalary(harry);               //调用方法tripleSalary
      System.out.println("After: salary=" + harry.getSalary());

      /*
       * Test 3: Methods can't attach new objects to object parameters
       */
      System.out.println("\nTesting swap:");
      var a = new Employee("Alice", 70000);    //定义一个类型为var的a,并进行初始化
      var b = new Employee("Bob", 60000);
      System.out.println("Before: a=" + a.getName());
      System.out.println("Before: b=" + b.getName());
      swap(a, b);               //交换函数
      System.out.println("After: a=" + a.getName());
      System.out.println("After: b=" + b.getName());
   }

   public static void tripleValue(double x) // doesn't work(不工作)
   {
      x = 3 * x;
      System.out.println("End of method: x=" + x);
   }

   public static void tripleSalary(Employee x) // works
   {
      x.raiseSalary(200);    //x的调用
      System.out.println("End of method: salary=" + x.getSalary());
   }
        //x和y进行交换
   public static void swap(Employee x, Employee y)
   {
      Employee temp = x;
      x = y;
      y = temp;
      System.out.println("End of method: x=" + x.getName());
      System.out.println("End of method: y=" + y.getName());
   }
}

class Employee // simplified Employee class
{
   private String name;     //实例域定义
   private double salary;

   public Employee(String n, double s)  //构造器定义
   {
      name = n;
      salary = s;
   }

   public String getName()     //实例域name的访问器方法
   {
      return name;
   }

   public double getSalary()    ////实例域Salary的访问器方法
   {
      return salary;
   }

   public void raiseSalary(double byPercent)
   {
      double raise = salary * byPercent / 100;
      salary += raise;
   }
}

  运行结果如下图:

实验2  测试程序4(5分)

  程序代码如下:

 import java.util.*;
 
  /**
   * This program demonstrates object construction.
   * @version 1.02 2018-04-10
   * @author Cay Horstmann
   */
  public class ConstructorTest
  {
    public static void main(String[] args)
    {
      // fill the staff array with three Employee objects   (用三个employee对象填充staff数组 )
     var staff = new Employee[3];

      staff[0] = new Employee("Harry", 40000);
      staff[1] = new Employee(60000);
      staff[2] = new Employee();
 
       // print out information about all Employee objects  (打印有关所有员工对象的信息 )
       for (Employee e : staff)    //foreach循环
          System.out.println("name=" + e.getName() + ",id=" + e.getId() + ",salary="
             + e.getSalary());
    }
 }
 
 class Employee
{
    private static int nextId;       //静态域nextId
   private int id;
   private String name = ""; // instance field initialization(实例字段intialization)
    private double salary;
  
  // static initialization block  (静态intialization块)
   static
   {
      var generator = new Random();
     // set nextId to a random number between 0 and 9999   (将nextId设置为0到999之间的随机值)
       nextId = generator.nextInt(10000);
    }

    // object initialization block    (对象intialization块)
   {
       id = nextId;
      nextId++;
    }
   // three overloaded constructors   //三个重载的构造
    public Employee(String n, double s)
    {
     name = n;
      salary = s;
  }

   public Employee(double s)
   {
       // calls the Employee(String, double) constructor   
      this("Employee #" + nextId, s);   //this用来引用当前对象
    }

    // the default constructor      //错误的构造器
   public Employee()
  {
       // name initialized to ""--see above
       // salary not explicitly set--initialized to 0
      // id initialized in initialization block
    }

   public String getName()   //实例域name的访问器方法
   {
       return name;
   }

   public double getSalary()  //实例域Salary的访问器方法  
   {
      return salary;
   }

    public int getId()    //实例域Id的访问器方法
    {
       return id;
    }
    }

  运行结果如下图所示:

实验2  测试程序5(5分)

  4-6程序代码如下:

import com.horstmann.corejava.*;
// the Employee class is defined in that package   (Employees类在该包中定义)

import static java.lang.System.*;   //静态导入System类
/**
 * This program demonstrates the use of packages.
 * @version 1.11 2004-02-19
 * @author Cay Horstmann
 */
public class PackageTest
{
   public static void main(String[] args)
   {
      // because of the import statement, we don't have to use 
      // com.horstmann.corejava.Employee here
      var harry = new Employee("Harry Hacker", 50000, 1989, 10, 1);

      harry.raiseSalary(5);

      // because of the static import statement, we don't have to use System.out here
      out.println("name=" + harry.getName() + ",salary=" + harry.getSalary());
   }
}

  运行结果如下图:

  4-7程序代码如下:

package com.horstmann.corejava;    //将类放入包中

// the classes in this file are part of this package   (这个文件中的类就是这个包中的一部分)

import java.time.*;   //java.time包的引入

// import statements come after the package statement   (import语句位于package语句之后)

/**
 * @version 1.11 2015-05-08
 * @author Cay Horstmann
 */
public class Employee
{
   private String name;     //实例域定义
   private double salary;
   private LocalDate hireDay;

   public Employee(String name, double salary, int year, int month, int day)  //构造器定义
   {
      this.name = name;   //this用来引用当前对象
      this.salary = salary;
      hireDay = LocalDate.of(year, month, day);     
   }

   public String getName()    //实例域name的访问器方法
   {
      return name;
   }

   public double getSalary()   //实例域Salary的访问器方法
   {
      return salary;
   }

   public LocalDate getHireDay()   //实例域HireDay的访问器方法
   {
      return hireDay;
   }

   public void raiseSalary(double byPercent)
   {
      double raise = salary * byPercent / 100;
      salary += raise;
   }
}

  运行结果如下图:

4. 实验总结:(10分)

     通过第四周的学习,掌握类的定义,熟悉属性、构造函数、方法的作用,掌握用类作为类型声明变量和方法返回值;理解类和对象的区别,类可以看做一个模板,我们可以根据类来创建很多的对象,而这些对象都具有我们在类中定义的方法和属性,类是抽象的,而对象是具体的。可以通过new关键字去实例化对象。还有掌握构造函数的使用,熟悉通过对象名引用实例的方法和属性;理解方法中的形参和实参传递在传递基本类型和引用类型的的差异;理解sstatic修饰符对类、类成员变量及类方法的影响 。通过编程和上机实验理解加java语言是如何体现面向对象编程基本思想,了解类的封装方法,以及加何创建类和对象,了解成员变量和成员方法的特性,掌握O0P方式进行程序设计的方话,了解共的继承性和多态性的作用。 

Guess you like

Origin www.cnblogs.com/qyhq/p/11563211.html