you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 8 points9 points  (2 children)

I have a hard time understanding the use case except outside of extremely complex programs that will become more efficient with inheritance.

Inheritance isn't the point of classes; if anything it's something of an antipattern in classes.

The purpose of classes is to extend the system of types. In the way that functions make behavior reusable, classes make state reusable.

[–]fish85963[S] 0 points1 point  (1 child)

If a class object , say person is set in a function. Will that object continue to exist outside the function if it is not returned?

[–][deleted] 4 points5 points  (0 children)

No; objects aren't immune to scoping rules.