-
Notifications
You must be signed in to change notification settings - Fork 0
Constructor
sancalle edited this page Oct 14, 2022
·
4 revisions
class Foo {
constructor() {
// initialization here
}
}
namespace Codeverter
{
public class Foo
{
public Foo()
{
// // initialization here
}
}
}
package codeverter
type Foo struct {
}
func NewFoo() *Foo {
f := Foo{}
// // initialization here
return &f
}
Namespace Codeverter
Public Class Foo
Public Sub Foo()
' // initialization here
End Sub
End Class
End Namespace
class Foo {
protected constructor() {
// initialization here
}
}
namespace Codeverter
{
public class Foo
{
protected Foo()
{
// // initialization here
}
}
}
Protected constructor as converted as PUBLIC
package codeverter
type Foo struct {
}
func NewFoo() *foo {
f := foo{}
// // initialization here
return &f
}
Namespace Codeverter
Public Class Foo
Protected Sub Foo()
' // initialization here
End Sub
End Class
End Namespace
class Foo {
private constructor() {
// initialization here
}
}
namespace Codeverter
{
public class Foo
{
private Foo()
{
// // initialization here
}
}
}
Private constructor as converted as PUBLIC
package codeverter
type Foo struct {
}
func NewFoo() *foo {
f := foo{}
// // initialization here
return &f
}
Namespace Codeverter
Public Class Foo
Private Sub Foo()
' // initialization here
End Sub
End Class
End Namespace
If visibility level was added to the constructor parameters, those are converted as properties.
class Foo {
constructor(public bar: string) {
// initialization here
}
}
namespace Codeverter
{
public class Foo
{
public string Bar { get; set; }
public Foo()
{
// // initialization here
}
}
}
package codeverter
type Foo struct {
Bar string
}
func NewFoo() *Foo {
f := Foo{}
// // initialization here
return &f
}
Namespace Codeverter
Public Class Foo
Public Property Bar As String
Public Sub Foo()
' // initialization here
End Sub
End Class
End Namespace