What is a local class? Why can it be useful?
Answer:
local class is a class defined within the scope of a function -- any function, whether a member function or a free function.
For example:
// Example 2: Local class
int f()
{
class LocalClass { // ... };
// ... };
Like nested classes, local classes can be a useful tool for managing code dependencies.
No comments:
Post a Comment