File tree 1 file changed +12
-1
lines changed
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ var Point = (function () {
35
35
return Point ;
36
36
})();
37
37
```
38
- This is a fairly idiomatic traditional JavaScript class pattern now as a first class language construct. Note that ` constructor ` is optional.
38
+ This is a fairly idiomatic traditional JavaScript class pattern now as a first class language construct.
39
39
40
40
### Inheritance
41
41
Classes in TypeScript (like other languages) support * single* inheritance using the ` extends ` keyword as shown below:
@@ -118,6 +118,15 @@ As always these modifiers work for both member properties and member functions.
118
118
* ` abstract ` ** classes** cannot be directly instantiated. Instead the user must create some ` class ` that inherit from the ` abstract class ` .
119
119
* ` abstract ` ** members** cannot be directly accessed and a child class must provide the functionality.
120
120
121
+ ### Constructor is optional
122
+
123
+ The class does not need to have a constructor. e.g. the following is perfectly fine.
124
+
125
+ ``` ts
126
+ class Foo {}
127
+ let foo = new Foo ();
128
+ ```
129
+
121
130
### Define using constructor
122
131
123
132
Having a member in a class and initializing it like below:
@@ -150,3 +159,5 @@ class Foo {
150
159
}
151
160
}
152
161
```
162
+
163
+
You can’t perform that action at this time.
0 commit comments