当前位置:网站首页>2021-05-11 abstract class
2021-05-11 abstract class
2022-06-23 10:07:00 【Deer like deer】
abstract class
abstract Modifiers can be used to modify methods or classes , If the modification method , So methods are abstract methods , If you modify a class, it is an abstract class
There can be no abstract methods in an abstract class , But a class with abstract methods must be declared as an abstract class
Abstract classes cannot use new Keyword to create the object , It is used to let subclasses inherit
Abstract method , Only method declaration , There is no way to achieve , It's used for subclasses to implement
Subclass inherits abstract class , Then you must implement abstract methods that are not implemented by abstract classes , Otherwise, the subclass should also be declared as an abstract class
package oop.demo10;
//abstract abstract class
public abstract class Action {
// constraint - Someone helped us achieve
//abstract, Abstract method , Only the method name , There is no way to achieve
public abstract void doSomething();
// You can't new This abstract class , It can only be implemented by subclasses : constraint
// Ordinary methods can be written in abstract classes
// Abstract methods must be in abstract classes
// Abstract abstract abstract
// The meaning of abstraction is to facilitate the use of code
}
package oop.demo10;
// All methods of an abstract class , Inherits its subclass , Must implement its methods
public class A extends Action {
@Override
public void doSomething() {
}
}
边栏推荐
- Install using snap in opencloudos NET 6
- 我被提拔了,怎么和原来平级的同事相处?
- Web -- Information Disclosure
- Go string comparison
- Unable to enter the system normally, press F8 to select other items to try to enter
- 高性能算力中心 — NVMe/NVMe-oF — NVMe-oF Overview
- Cloud native database Amazon RDS
- 谷贱伤农,薪贱伤码农!
- 炫酷相册代码,祝对象生日快乐!
- RT thread add MSH command
猜你喜欢

Bioinformatics | effective drug target correlation prediction based on interacting neural network

搭建一个QQ机器人叫女友起床

laravel8 beanstalk 使用说明

Servlet-02 lifecycle

Comic | code review is driving me crazy!

AI系统前沿动态第38期:谷歌已放弃TensorFlow?;训练大模型的四种GPU并行策略;LLVM之父:模块化设计决定AI前途

Personal blog system graduation project opening report

Typora set up image upload service

Alimentation des animaux de compagnie basée sur stm32

Go 字符串比较
随机推荐
在OpenCloudOS使用snap安装.NET 6
sql根据比较日期新建字段
同花顺推荐么?手机开户安全么?
Install using snap in opencloudos NET 6
Build a security video monitoring platform using Huawei cloud ECS server
高性能算力中心 — NVMe/NVMe-oF — NVMe-oF Overview
Developer, you may have some misunderstandings about cloud computing
2021-05-11static关键字
NIO例子
搭建一个点歌QQ机器人,另外还能看美女
mysql中innodb下的redo log什么时候开始执行check point落盘的?
2021-04-16 method overload parameter transfer
几款实用软件分享
2021-05-07构造器
J. Med. Chem. | Release: a new drug design model for deep learning based on target structure
2021-05-11 static keyword
用贪吃蛇小游戏表白(附源码)
Unity技术手册 - 生命周期内速度限制(Limit Velocity Over Lifetime)子模块和速度继承(Inherit Velocity)子模块
Copilot免费时代结束!正式版67元/月,学生党和热门开源项目维护者可白嫖
AI系统前沿动态第38期:谷歌已放弃TensorFlow?;训练大模型的四种GPU并行策略;LLVM之父:模块化设计决定AI前途