Skip to content

Latest commit

 

History

History
88 lines (75 loc) · 1.74 KB

File metadata and controls

88 lines (75 loc) · 1.74 KB
title __raise | Microsoft Docs
ms.custom
ms.date 11/04/2016
ms.reviewer
ms.suite
ms.technology
cpp-language
ms.tgt_pltfrm
ms.topic language-reference
f1_keywords
__raise
__raise_cpp
dev_langs
C++
helpviewer_keywords
__raise keyword [C++]
ms.assetid 6f1ae418-5f0f-48b6-9f6e-8ea7e66b239a
caps.latest.revision 10
author mikeblome
ms.author mblome
manager ghogen
translation.priority.ht
cs-cz
de-de
es-es
fr-fr
it-it
ja-jp
ko-kr
pl-pl
pt-br
ru-ru
tr-tr
zh-cn
zh-tw

__raise

Emphasizes the call site of an event.

Syntax

  
__raise   
method-declarator  
;  
  

Remarks

From managed code, an event can only be raised from within the class where it is defined. See event for more information.

The keyword __raise causes an error to be emitted if you call a non-event.

Note

A templated class or struct cannot contain events.

Example

// EventHandlingRef_raise.cpp  
struct E {  
   __event void func1();  
   void func1(int) {}  
  
   void func2() {}  
  
   void b() {  
      __raise func1();  
      __raise func1(1);  // C3745: 'int Event::bar(int)':   
                         // only an event can be 'raised'  
      __raise func2();   // C3745  
   }  
};  
  
int main() {  
   E e;  
   __raise e.func1();  
   __raise e.func1(1);  // C3745  
   __raise e.func2();   // C3745  
}  

See Also

Keywords
Event Handling
Component Extensions for Runtime Platforms