__declspec(hidesbase)

From RAD Studio
Jump to: navigation, search

Go Up to Keywords, Alphabetical Listing Index


Category

Modifiers (C++), Keyword Extensions, Storage Class Specifiers (C++)

Syntax

__declspec(hidesbase) declarator

The hidesbase argument is used for compatibility with Delphi. It is used to change the standard C++ overriding semantics so that Delphi code can be ported to C++ with minimum modifications.

Note: You can use the macro HIDESBASE, defined in sysmac.h, as an alternative for __declspec(hidesbase).

The following code example shows the effect of macro HIDESBASE:

Method f is overridden. With HIDESBASE, method f is not overridden.
class T1 {
public:
 virtual void f() 
 {
  puts("T1::f");
 }
};

class T2 : public T1 {
public:
 void f() 
 {
  puts("T2::f");
 }
};

// ...
T1 *t = new T2();
t->f(); // displays T2::f
class T1 {
public:
 virtual void f() 
 {
  puts("T1::f");
 }
};

class T2 : public T1 {
public:
 HIDESBASE void f() 
 {
  puts("T2::f");
 }
};

// ...
T1 *t = new T2();
t->f(); // displays T1::f

See Also