Wiki

Changes between Initial Version and Version 1 of AccessModifiers

Show
Ignore:
Timestamp:
05/04/08 14:05:26 (17 years ago)
Author:
hopscc
Comment:

attempt to describe isNames

Legend:

Unmodified
Added
Removed
Modified
  • AccessModifiers

    v1 v1  
     1= Access Modifiers = 
     2 
     3Access Modifiers can be specified  on Classes, Class (instance and class) variables and methods to set their visibility and accessibility  
     4These are also called 'isNames' in the Cobra doc and Discussion since they're specified with a leading '''is''' keyword. 
     5 
     6Method Access modifiers 
     7    '''virtual, public''' is default for methods[[BR]] 
     8 
     9    '''protected''' is default for class/instance variables with '''_''' prefix on name[[BR]] 
     10    '''public''' is default for variables without '''_''' prefix 
     11 
     12Valid 'is' keywords are  
     13 *       '''fake''' - specifies item has no implementation - a placeholder 
     14 *       '''shared''' - Specifies Class (static) method or variable,  
     15 *       '''virtual''',   '''nonvirtual''' -  on methods, specifies that its overridable or not  
     16 *       '''override''', '''new'''         - on methods specifies that a method is overriding or replacing a baseclass method of same  signature 
     17 *       '''public''', '''protected''', '''private''', '''internal''' - specifies item visibility  
     18 *       '''abstract''' - specifies a template only, subclasses must define 
     19 
     20Separate multiple by modifiers with ''',''' e.g    ....  is protected, override 
     21      
     22    is fake:: 
     23       temporary for defining class/method api without implementation 
     24e.g 
     25{{{      
     26class TextWriter 
     27    is fake 
     28 
     29    get newLine as String 
     30        pass 
     31}}} 
     32    
     33    is shared:: 
     34        on instance variable makes it a class variable  
     35            (same as static (in Java)) 
     36 
     37    is public/protected/private:: 
     38        on class or method(s) 
     39        adjust visibility (default public) 
     40 
     41    is abstract:: 
     42        on class or method(s) 
     43        Is a Template for subclasses to provide implementation of. 
     44 
     45    is virtual:: 
     46       method is redefinable 
     47 
     48    is nonvirtual::     
     49        method is not redefinable 
     50     
     51    is override:: 
     52        Specifies that this method implementation is a redefinition of an existing(shadowed virtual or abstract) method defined in a superclass 
     53    is new::  
     54        Designate that this method is a new one that hides the one that would have  
     55        been inherited from a baseclass. 
     56        e.g 
     57{{{ 
     58class Vehicle 
     59 
     60    def drive is nonvirtual 
     61        pass 
     62 
     63class Car inherits Vehicle 
     64 
     65    def drive is new 
     66       pass 
     67}}} 
     68 
     69When a method, property or indexer has the same name and type signature as a base member,  
     70you must specify '''is override''' or specify '''is new'''  
     71or use '''base.''' in the implementation (which is an implicit '''is override''')