abstract modifier added for classes and methods
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
abstract class A {
|
||||
abstract void callme();
|
||||
|
||||
void callmetoo() {
|
||||
print("This is a concrete method.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
abstract open class A {
|
||||
abstract fun callme() : Unit
|
||||
fun callmetoo() : Unit {
|
||||
print("This is a concrete method.")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
abstract class Shape {
|
||||
public String color;
|
||||
public Shape() {
|
||||
}
|
||||
public void setColor(String c) {
|
||||
color = c;
|
||||
}
|
||||
public String getColor() {
|
||||
return color;
|
||||
}
|
||||
abstract public double area();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
abstract open class Shape {
|
||||
public var color : String?
|
||||
public fun setColor(c : String?) : Unit {
|
||||
color = c
|
||||
}
|
||||
public fun getColor() : String? {
|
||||
return color
|
||||
}
|
||||
abstract public fun area() : Double
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
abstract int getNoofGears();
|
||||
@@ -0,0 +1 @@
|
||||
abstract fun getNoofGears() : Int
|
||||
Reference in New Issue
Block a user