Definition of a class
1, with the variables and functions, they and to a piece is not a class?
class People {
var name: String;
var age: Integer;
}
class Hello {
var people: People;
function Greeting() {
println("Hello {people.name} ,You are {people.age} years old.");
}
}
Second, abstract classes and interfaces
1. Abstract classes are decorated with the abstract keyword
abstract class People {
var name: String;
var age: Integer;
}
Abstract classes, like other object-oriented languages, cannot create instances.
2, there is no interface in JavaFX, but can directly use the interface in Java
interface IHello{
void Greeting();
}
Ii. Succession of classes
1, with the extends keyword from another class to inherit
class Man extends People{
var sex:Boolean;
}
2, from the abstract class or interface inheritance, also with the extends keyword, the interface method must be overloaded, with the override keyword
class Hello extends IHello{
var people: People;
override function Greeting():Void {
println("Hello {people.name} ,You are {people.age} years old.");
}
}
3, JavaFX can be multiple inheritance, that is, inheriting multiple classes and multiple interfaces