Re: [Mono-list] Keyword this or base expected(CS1018)
> Thanks People. I have that working now :-) Great! Happy Hacking, Gaurav Vaish http://gallery.mastergaurav.net - ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Keyword this or base expected(CS1018)
On Sun, 2004-08-22 at 19:54, Gaurav Vaish wrote: > Rob, > > Can you give the details of: > > - The base class (namespace, name and preferably, also the constructors) > - What you intend to do in your sub-class, if non-classified. > > We may be able to help you better... namespace is just one of my own and not really important. What I am trying to do is my base class is basically common code surrounding a treeview, I then generate 4 of these with a couple of extra methods for differing purposes, but 90% of the code around the 4 treeviews will be the same, hence the base calls and child classes... -- Rob Brown-Bayliss ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Keyword this or base expected(CS1018)
On Sun, 2004-08-22 at 19:54, Gaurav Vaish wrote: Thanks People. I have that working now :-) -- Rob Brown-Bayliss Some days you wake up with her complaining Some sunny days you wish it was raining Some days are sulky, some days have a grin And some days have bouncers and won't let you in ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Keyword this or base expected(CS1018)
Rob, Can you give the details of: - The base class (namespace, name and preferably, also the constructors) - What you intend to do in your sub-class, if non-classified. We may be able to help you better... Having said that, Gennady's example would be the perfect starting point for you to pickup. Cheers, Gaurav http://gallery.mastergaurav.net -- On Sun, 22 Aug 2004 16:56:55 +1200, Rob Brown-Bayliss <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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 - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Keyword this or base expected(CS1018)
of course this wont compile, since you class needs to be deriving from a class which we will consider a base that has a constructor that takes your type of arguments: so to correct the below should look like this: class MyBase { public MyBase (Glade.XML gxml, Database database) { // rest of your construction logic goes here } class MyClass : MyBase { public MyClass (Glade.XML gxml, Database database) : base(gxml, database) { // rest of your construction logic goes here } hope this helps. On 8/21/04 10:15 PM, "gennady wexler" <[EMAIL PROTECTED]> wrote: > 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" <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> >>> 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 - [EMAIL PROTECTED] >> http://lists.ximian.com/mailman/listinfo/mono-list > > > ___ > Mono-list maillist - [EMAIL PROTECTED] > http://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Keyword this or base expected(CS1018)
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" <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> >> 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 - [EMAIL PROTECTED] > http://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Keyword this or base expected(CS1018)
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 <[EMAIL PROTECTED]> 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 - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Keyword this or base expected(CS1018)
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 <[EMAIL PROTECTED]> 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 - [EMAIL PROTECTED] > http://lists.ximian.com/mailman/listinfo/mono-list > ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
[Mono-list] Keyword this or base expected(CS1018)
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 - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list