scala 方法调用_Scala中的方法调用

scala 方法调用

Scala方法调用 (Scala Method Invocation)

Method invocation is the legal and correct technique to call a method in Scala programming language. The methods of a class are usually accessed by using two methods.

方法调用是用Scala编程语言调用方法的合法且正确的技术。 通常使用两种方法来访问类的方法。

  1. Object Creation

    对象创建

  2. Inheritance

    遗产

We dynamically call methods of a class using the object of the class. the correct way of accessing the methods using object are:

我们使用类的对象动态调用类的方法。 使用object访问方法的正确方法是:

1)使用点运算符调用方法 (1) Invoking methods using dot operator)

While calling a method of a class from the object of the class we use the dot (.) operator. The correct and legal way of accessing the methods of a class in Scala using the dot operator is,

从类的对象调用类的方法时,我们使用点(。)运算符。 使用点运算符访问Scala中的类方法的正确合法方法是,

    object_name.method_name(parameters)

This is the most appropriate way of accessing the method of a class using an object. Else than this some ways can be used but

你可能感兴趣的:(编程语言,python,java,scala,设计模式)