Skip to content
Discussion options

You must be logged in to vote

one piece design

`
export default class MyLocalStorage {
// Static properties and object properties are the two major members of a class
static localStorage: MyLocalStorage;

private constructor() {
console.log("This is the constructor of the static method of the singleton design pattern of ts");
}

// Provide a method for external access, through which this method is used to provide a method for external access to an object
// 1. A method with the static keyword is a static method
// 2. Static methods have nothing to do with objects, external object variables cannot call static methods and static properties
// 3. External can be called by class name
// Static methods cannot access instan…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by xiao-ice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants