Friday 5 April 2013

What is a local class? Why can it be useful?



What is a local class? Why can it be useful?
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.


Blog Author: Vijay Kumar

No comments:

Post a Comment