12.12.2012 Views

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

496 Day <strong>14</strong><br />

__published<br />

The __published keyword is used when you want a property to be displayed <strong>in</strong> the Object<br />

Inspector at design time. This keyword is used <strong>in</strong> a class declaration just like the public,<br />

private, and protected keywords are used. For example, a typical class declaration for a<br />

<strong>C++</strong>Builder component might look like this:<br />

class TFlash<strong>in</strong>gLabel : public TCustomLabel<br />

{<br />

private:<br />

//<br />

// Private data members and functions here.<br />

//<br />

protected:<br />

//<br />

// Protected data members and functions here.<br />

//<br />

public:<br />

//<br />

// Public data members and functions here.<br />

//<br />

__published:<br />

//<br />

// The component’s published properties here.<br />

//<br />

__property <strong>in</strong>t FlashLimit = {read=FFlashLimit, write=FFlashLimit, default=0};<br />

// more property declarations<br />

};<br />

Any properties <strong>in</strong> the __published section will be displayed <strong>in</strong> the Object Inspector at design<br />

time. Although the implementation of the __published keyword is trivial, this keyword is one<br />

of the major keywords from the standpo<strong>in</strong>t of <strong>C++</strong>Builder extensions to the <strong>C++</strong> language.<br />

Summary<br />

Programm<strong>in</strong>g languages evolve based on many factors. One of the most viable reasons for a<br />

language to evolve is because programmers require a language feature not found <strong>in</strong> the current<br />

<strong>in</strong>carnation of that language. That’s the way it should be: Ask and ye shall receive—or at least<br />

have a chance of receiv<strong>in</strong>g at some po<strong>in</strong>t <strong>in</strong> the future. Programm<strong>in</strong>g languages are rarely<br />

static. They are almost always chang<strong>in</strong>g to some degree or another. Changes to a language<br />

frequently challenge the comfort level of many of the users of that language. While I don’t<br />

promote change just for the sake of change, I am certa<strong>in</strong>ly open to language extensions when<br />

they make sense.<br />

The fact is that <strong>Borland</strong> decided to add extensions to the <strong>C++</strong> language. Those extensions give<br />

<strong>C++</strong>Builder much of its power. It is po<strong>in</strong>tless to debate the language extensions. You can<br />

either use <strong>C++</strong>Builder with all its power and accept the extensions to the <strong>C++</strong> language, or

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!