<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to keywords-new</title><link>https://sourceforge.net/p/asil/wiki/keywords-new/</link><description>Recent changes to keywords-new</description><atom:link href="https://sourceforge.net/p/asil/wiki/keywords-new/feed" rel="self"/><language>en</language><lastBuildDate>Wed, 19 Feb 2014 14:19:35 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/asil/wiki/keywords-new/feed" rel="self" type="application/rss+xml"/><item><title>keywords-new modified by Will Pittenger</title><link>https://sourceforge.net/p/asil/wiki/keywords-new/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v1
+++ v2
@@ -1,3 +1,7 @@
+[TOC]
+
+Overview
+========
 The **new** keyword allocates memory when used in code and calls the constructor for the type the memory is being allocated for.  When used as part of the declaration of a data member, method, property, nested type; it allows you to override something in your base type that would be hidden by your new member, method, property, or nested type.

 When declaring member, method, property, or nested type
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Will Pittenger</dc:creator><pubDate>Wed, 19 Feb 2014 14:19:35 -0000</pubDate><guid>https://sourceforge.net2b90ab96848464a594f8fd81e00b925fb2db1d68</guid></item><item><title>keywords-new modified by Will Pittenger</title><link>https://sourceforge.net/p/asil/wiki/keywords-new/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;The &lt;strong&gt;new&lt;/strong&gt; keyword allocates memory when used in code and calls the constructor for the type the memory is being allocated for.  When used as part of the declaration of a data member, method, property, nested type; it allows you to override something in your base type that would be hidden by your new member, method, property, or nested type.&lt;/p&gt;
&lt;h1 id="when-declaring-member-method-property-or-nested-type"&gt;When declaring member, method, property, or nested type&lt;/h1&gt;
&lt;p&gt;Normally, ASIL compilers must issue an error if you're declaring something that would hide something inside your base type.  (If the method or property is &lt;strong&gt;&lt;a class="" href="../keywords-virtual"&gt;virtual&lt;/a&gt;&lt;/strong&gt;, use &lt;strong&gt;&lt;a class="" href="../keywords-override"&gt;override&lt;/a&gt;&lt;/strong&gt; instead.)  This changes if you add the &lt;strong&gt;new&lt;/strong&gt; keyword to the declaration.  Now your data member, method, property, or nested type is visible instead of the one in the base type.  The code sample below shows only part of the declaration.&lt;/p&gt;
&lt;p&gt;Note: Since namespaces in ASIL can derive from one another, you might need &lt;strong&gt;new&lt;/strong&gt; to hide a member from your base-namespace.&lt;/p&gt;
&lt;h2 id="procedures"&gt;Procedures&lt;/h2&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;/AccessQualifiersAndOtherModifiers/ [\new\] (\command\ | \function\ | \statement\) /identifier/
  ' Implement it
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;/AccessQualifiersAndOtherModifiers/ varies depending on what you're declaring.  Everything needs an access qualifier.  The keywords &lt;strong&gt;&lt;a class="" href="/p/asil/wiki/keywords-const/"&gt;const&lt;/a&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;a class="" href="../keywords-static"&gt;static&lt;/a&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;a class="" href="/p/asil/wiki/keywords-final/"&gt;final&lt;/a&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;a class="" href="../keywords-virtual"&gt;virtual&lt;/a&gt;&lt;/strong&gt;, and &lt;strong&gt;&lt;a class="" href="/p/asil/wiki/keywords-abstract/"&gt;abstract&lt;/a&gt;&lt;/strong&gt; might or might not be valid.&lt;/p&gt;
&lt;h2 id="types"&gt;Types&lt;/h2&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;/AccessQualifiersAndOtherModifiers/ [\new\] (\enum\ [\struct\] | [\struct\] | [\class\]) /identifier/
  ' Declare the rest of the type
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;/AccessQualifiersAndOtherModifiers/ varies depending on what you're declaring.  Everything needs an access qualifier unless its global and outside a space.  The &lt;strong&gt;&lt;a class="" href="/p/asil/wiki/keywords-inner/"&gt;inner&lt;/a&gt;&lt;/strong&gt; keyword can be applied if the type is nested inside another type and not just a namespace.  Any type may or may not need &lt;strong&gt;&lt;a class="" href="/p/asil/wiki/keywords-const/"&gt;const&lt;/a&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;a class="" href="/p/asil/wiki/keywords-final/"&gt;final&lt;/a&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;a class="" href="/p/asil/wiki/keywords-abstract/"&gt;abstract&lt;/a&gt;&lt;/strong&gt;, or &lt;strong&gt;&lt;a class="" href="../keywords-static"&gt;static&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id="constants"&gt;Constants&lt;/h2&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;(\public\ | \protected\ | \private\) [\new\] \const\ /TypeDescriptor/ /identifier/ \=\ /DefaultValue/
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;For what /TypeDescriptor/ can be, see &lt;a class="" href="../Appendices-Terms-Type%20descriptors"&gt;Type descriptors&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="other-data-members"&gt;Other data members&lt;/h2&gt;
&lt;p&gt;This isn't required for local variables.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;(\public\ | \protected\ | \private\) [\new\] \var\ /TypeDescriptor/ /identifier/ [\=\ /DefaultValue/
&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="properties"&gt;Properties&lt;/h2&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;(\public\ | \protected\ | \private\) [(\virtual\ | \final\ | \abstract\)] [\static\] [\new\] \property\ /TypeDescriptor/ /identifier/
  [[(\virtual\ | \final\ | \abstract\)] \get\
    ' return some value
  ]

  [[(\virtual\ | \final\ | \abstract\)] \set\
    ' Do something with the value keyword
  ]
&lt;/pre&gt;&lt;/div&gt;
&lt;h1 id="when-allocating-memory"&gt;When allocating memory&lt;/h1&gt;
&lt;p&gt;When you allocate memory with the &lt;strong&gt;new&lt;/strong&gt; keyword, it calls the &lt;strong&gt;&lt;a class="" href="/p/asil/wiki/keywords-creator/"&gt;creator&lt;/a&gt;&lt;/strong&gt; for the type followed by the &lt;strong&gt;&lt;a class="" href="/p/asil/wiki/keywords-constructor/"&gt;constructor&lt;/a&gt;&lt;/strong&gt; for the new instance.  It then returns a reference to the new instance.  Any parameters you pass to &lt;strong&gt;new&lt;/strong&gt; are also passed to the  &lt;strong&gt;&lt;a class="" href="/p/asil/wiki/keywords-creator/"&gt;creator&lt;/a&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;a class="" href="/p/asil/wiki/keywords-constructor/"&gt;constructor&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;`` Do something with the instance `` \=\ \new\ /ParameterList/
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can also place everything from the &lt;strong&gt;new&lt;/strong&gt; keyword through the last parameter to be passed to the &lt;strong&gt;&lt;a class="" href="/p/asil/wiki/keywords-creator/"&gt;creator&lt;/a&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;a class="" href="/p/asil/wiki/keywords-constructor/"&gt;constructor&lt;/a&gt;&lt;/strong&gt;, but no more, in parentheses.  This lets you access members with the &lt;strong&gt;&lt;a class="" href="../operators-member"&gt;.&lt;/a&gt;&lt;/strong&gt; operator.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;(new /ParameterList/)\.\/SomeMember/
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Will Pittenger</dc:creator><pubDate>Wed, 19 Feb 2014 14:19:06 -0000</pubDate><guid>https://sourceforge.net8c1f1c1251f7e472beae2a7d8dfc4d1a94a8d145</guid></item></channel></rss>