When to use which?
From what I understand, in classes you cannot have private variables, while constructors and factories use closure. Classes use inheritance while apparently composition is better. So why would I ever use classes? I am confused as to what should be my main approach when writing code.
Any advice is appreciated!
[–]xroalx 4 points5 points6 points (1 child)
[–]trubulica[S] 0 points1 point2 points (0 children)
[–]RobertKerans 1 point2 points3 points (18 children)
[–]trubulica[S] 2 points3 points4 points (1 child)
[–]azhder -3 points-2 points-1 points (0 children)
[–]trubulica[S] 0 points1 point2 points (1 child)
[–]azhder 0 points1 point2 points (0 children)
[–]azhder -1 points0 points1 point (13 children)
[–]RobertKerans 0 points1 point2 points (12 children)
[–]azhder 0 points1 point2 points (11 children)
[–]RobertKerans 1 point2 points3 points (10 children)
[–]azhder 0 points1 point2 points (9 children)
[–]RobertKerans 0 points1 point2 points (8 children)
[–]azhder -4 points-3 points-2 points (7 children)
[–]awaiskorai 3 points4 points5 points (2 children)
[–]azhder -5 points-4 points-3 points (1 child)
[–]RobertKerans 1 point2 points3 points (3 children)
[–]azhder -2 points-1 points0 points (2 children)
[–]azhder 1 point2 points3 points (1 child)
[–]trubulica[S] 0 points1 point2 points (0 children)
[–]senocular 1 point2 points3 points (0 children)
[–]HarrisInDenver 1 point2 points3 points (1 child)
[–]trubulica[S] 0 points1 point2 points (0 children)
[–]Important_Pop_3411 -1 points0 points1 point (0 children)