You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found out that it is difficult to write a complex program: we need classes.
C++ is actually C with classes, so maybe you can update it and reneme to Z++
I suggest to use this syntax:
class ExampleClass (SuperClass)
{
func constructor(Param1, Param2, ...)
{
// This function is called when the instantiated object is created
// [some code]
int this.example_attribute = 10
super() // call constructor function of super class
this.super().ExampleMethod() // call the static method 'ExampleMethod' of SuperClass
this.ExampleMethod2() // This is not defined in ExampleClass, so it will look for this function in SuperClass
}
func example_method(Param1, Param2, ...)
{
// [some code]
}
static int example_static_attr = 15
// a static attribute/method is the attribute of class
// e.g.
// >> ExampleClass ExampleInstantiatedObj = (1, 2, 3)
// >> printl(ExampleInstantiatedObj.example_static_attr) => error
// >> printl(ExampleClass.example_static_attr) => 15
static func example_static_method(Param1, Param2, ...)
{
// [some code]
}
}
ExampleClass a = (1, 2, 3) // this calls a.contructor(1, 2, 3)
a.example_method()
P.S. This idea is mainly from javascript (constructor right?)
also it should support operator overloading then it looks much better
The text was updated successfully, but these errors were encountered:
I found out that it is difficult to write a complex program: we need classes.
C++ is actually C with classes, so maybe you can update it and reneme to Z++
I suggest to use this syntax:
P.S. This idea is mainly from javascript (constructor right?)
also it should support operator overloading then it looks much better
The text was updated successfully, but these errors were encountered: