首页> 外文期刊>C - C++ Users Journal >Advanced Subclassing
【24h】

Advanced Subclassing

机译:高级子类化

获取原文
获取原文并翻译 | 示例
获取外文期刊封面目录资料

摘要

Whenever you implement an event handler for a C++ window class, when such a window (or window that extends it) gets created on-screen, "subclassing" occurs behind the scenes. If you've programmed nontrivial GUI apps, you're probably familiar with the term. Simply put, if you subclass a window, you get to handle its events first. As Listing 1 shows, whenever you say create_wnd < hyper_link > (par), the hyperlink's event handler gets created and subclassing occurs. Event handlers are inherited. If you extend a window class, you automatically inherit all its event handler(s)—its base class(es), event handler(s), and the like. This makes sense because base class(es) need to implement their logic. In Listing 2, the sample_dlg class automatically inherits the event handler(s) from the dialog class (and its base class(es)) and from the resizable_wnd class (and its base class(es)).
机译:每当为C ++窗口类实现事件处理程序时,当在屏幕上创建此类窗口(或扩展它的窗口)时,幕后就会发生“子类化”。如果您已经编写了平凡的GUI应用程序,则可能对这个术语很熟悉。简而言之,如果您将窗口子类化,则必须先处理其事件。如清单1所示,每当您说create_wnd (参数)时,就会创建超链接的事件处理程序并发生子类化。事件处理程序是继承的。如果扩展窗口类,则会自动继承其所有事件处理程序-它的基类,事件处理程序等。这是有道理的,因为基类需要实现其逻辑。在清单2中,sample_dlg类自动从对话框类(及其基类)和resizable_wnd类(及其基类)继承事件处理程序。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号