# Solidity笔记 **Published by:** [Chris Gao](https://paragraph.com/@sec-dao/) **Published on:** 2022-05-16 **URL:** https://paragraph.com/@sec-dao/solidity ## Content Contract类的几种类型Contract: 正常可部署的合约Abstract Contract: 存在部分未实现的方法Interface: 所有方法均无实现Library:库,封装常用的工具类和方法,不能对状态变量和存储进行更改Modifier:类似拦截器,AOP编程;定义一个modifier可以修辞某方法变量关键字payable:可接受付款的地址变量memory:动态内存,不会被存储,使用完后被EVM回收public:外部可访问private:内部可访问函数可见性public: 内部外部均可见private: 只有当前合约内部可见external: 供外部调用,内部调用使用this关键字internal: 只有内部可见,可以被继承virtual:子类继承实现,实现方法需加override关键字payable:可接受付款的方法修饰符pure for functions: 禁止对状态变量的访问和修改view for functions: 禁止修改状态变量,但可以修改payable for functions: 可接受付款constant for state variables: 常量immutable for state variables: Allows exactly one assignment at construction time and is constant afterwards. Is stored in code.anonymous for events: 不作为主题存储及用于检索indexed for event parameters: 将参数作为主题存储,可用于检索virtual for functions and modifiers: 子类可重写覆盖override: 重写父类方法时标记 ## Publication Information - [Chris Gao](https://paragraph.com/@sec-dao/): Publication homepage - [All Posts](https://paragraph.com/@sec-dao/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@sec-dao): Subscribe to updates