this is code from a youtube tutorial, i'v seen it compile properly in his video. i tried asking the author via comments but yet to get a reply. hence seeking advice here as well.
I'v tried making the constructors public by adding
Public:
but apparently the syntax is wrong.
Brushing up my fundamentals now, before trying leetcode challenges again...
Currently all methods and data members of your class are default declared private. Every one of your ctors are inaccessible outside the class itself. Lines 23, 25 & 27 will error out.
And it is public: (lower case), NOT Public:.
Mistyped case is a very core "gotcha" factor in C/C++.
Learn C++ might be more of a help to cram C++ into your cranium than youtube videos.
> how did the youtube author manage to compile his code
The author could not have managed to compile the code as in the original post without errors
(with a reasonably conforming C++ compiler).
Maybe the code that was actually compiled was different from the one that was posted.
I suspect that class was originally struct and that at some point it got changed without other required changes. struct and class are very similar except that struct all are public by default with class all are private by default.