Should I submit another defect in the C ++ design to the C ++ Standards Committee? -- Class names should not be used for constructors and destructor names
If the class name is used, it is information redundancy.
Class Test
{
Test ();
Test (INT, Int, char *);
Test (...);
...
}
Now, if I want to change test to Test2, we need to change four places, which is difficult to maintain.
Class Test2
{
Test2 ();
Test2 (INT, Int, char *);
Test2 (...);
...
}
Solution:
Introduce the keyword _ init as the name of the constructor,
Class Test
{
_ Init ();
_ Init (INT, Int, char *);
_ Init (...);
...
}
Now you only need to change the name to test.
Class Test2
{
_ Init ();
_ Init (INT, Int, char *);
_ Init (...);
...
}
My Taiji language can be like this now, haha
What about destructor? What is the name?
Close, destroy ,~ _ Init. Let me think about it.
What about _ init called _ begin?