[Mono-list] Keyword this or base expected(CS1018)

gennady wexler adyler@winisp.net
Sat, 21 Aug 2004 22:15:59 -0700


in constructor of your class:

class MyClass {
    public MyClass(Glade.XML gxml, Database database)
        : base(gxml, database) {
        // rest of your construction logic goes here
    }

you base class needs to be ready for the case if null objects were passed
and react accordingly.

On 8/21/04 9:56 PM, "Rob Brown-Bayliss" <rbb@orcon.net.nz> wrote:

> 
> OK, so how do I pass args to the base class?
> 
> I thought:
> 
> MyClass my_class = new MyClass(gxml, database);
> 
> would pass gxml and database to the base class of MyClass?
> 
>> This is wrong.
>> 
>> While calling the contructor, the gxml and database are undefined. If
>> you be appropriate to call as:
>> 
>> public MyClass(): base(null, null)
>> {
>> ...
>> }
>> 
>> or better still:
>> 
>> public MyClass(): base( (Glade.XML) null, (Database) null )
>> {
>> ...
>> }
>> 
>> Use the latter option if there are more than one overloaded
>> consturctor in the base class that can make up for BaseClass(null,
>> null).
>> 
>> NB: I have assumed that Glade.XML is not enum.
>> 
>> 
>> 
>> Cheers,
>> Gaurav Vaish
>> http://gallery.mastergaurav.net
>> -----------------------------------
>> 
>> 
>> On Sun, 22 Aug 2004 16:19:03 +1200, Rob Brown-Bayliss <rbb@orcon.net.nz>
>> wrote:
>>> 
>>> Why does this:
>>> 
>>> public MyClass() : base (Glade.XML gxml, Database database)
>>> 
>>> give me this error?
>>> 
>>> Keyword this or base expected(CS1018)
> 
> --
> Rob Brown-Bayliss
> 
> ________________________________________________________________________
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list