Abstract
/// abstract keyword class
/// abstract function
/// No object of abstract class
/// abstract class contains normal functions and variables
/// Syntax
// abstract class ClassName {
// // Body of abstract class
// }
//In Dart, an abstract class is defined as a class that contains one or more abstract methods.
// The abstract keyword is used to declare abstract classes.
//Methods that are declared but not implemented are known as abstract methods.
//The concrete methods (also known as normal methods) are declared along with their implementation.
// Both kinds of methods can be found in an abstract class, but abstract methods cannot be found in a normal class.
//A class that contains an abstract method must be declared abstract,
// while a class that is declared abstract can have either abstract or concrete methods.
//If the class contains at least one abstract method, it must be declared abstract.
// The abstract class’s object cannot be created, but it can be extended.
// An abstract class is declared with the abstract keyword.
// Normal or concrete methods can be included in an abstract class.
// The subclass must implement all of the parent class’s abstract methods.
main() {
var obj = new hdfc();
print(obj.name);
print(obj.id_proff());
}
abstract class rbi {
var name = "Vishal";
id_proff();
test() {}
}
//Abstract function must be make OR defined in the Child Class
class hdfc extends rbi {
id_proff() { }
test() {}
}
Comments
Post a Comment