代码之家  ›  专栏  ›  技术社区  ›  Khaled Alshaya

经典C++的调用/返回功能(C带类),现代语言有哪些呢?

  •  10
  • Khaled Alshaya  · 技术社区  · 16 年前

    第57页,共页 The Design and Evolution of C++ ,Stroustrup博士谈到了一个特性,它最初是C中带有类的一部分,但它不是现代C++的一部分(标准C++)。此功能称为 call/return . 这是一个例子:

    class myclass
    {
      call() { /* do something before each call to a function. */ }
      return() { /* do something else after each call to a function. */ }
      ...
    };
    

    3 回复  |  直到 16 年前
        1
  •  7
  •   Potatoswatter    16 年前

    call() return()

        2
  •  2
  •   Romain Hippeau    16 年前

    面向方面的编程有这一点。 http://en.wikipedia.org/wiki/Aspect-oriented_programming

    面向方面编程(也称为AOP)能够在代码之前、之后和周围创建拦截器。

        3
  •  0
  •   Felan    14 年前

    D2编程语言有这一点,还有更多 ScopeGuards