PC Review


Reply
Thread Tools Rate Thread

Compiling error

 
 
Curious
Guest
Posts: n/a
 
      14th Aug 2009
The code below doesn't compile (after I added ": IComparable" on the
first line). Any advice on how to get it compiled?

public class LongTermLimitOnBuy : LongTermLimit : IComparable
{
public LongTermLimitOnBuy(double price, int shares) : base
(price, shares)
{
}

// Sort by Price in descending order
public int CompareTo(object other)
{

if (null == other)
{
throw new ArgumentNullException("other");
}
if (other is LongTermLimitOnBuy)
{
return (this.Price - (other as
LongTermLimitOnBuy).Price >= 0 ? 1 : 0);
}
else
{
throw new InvalidOperationException("Bad type");


}
}
}
 
Reply With Quote
 
 
 
 
Markus Betz
Guest
Posts: n/a
 
      14th Aug 2009
Curious wrote:
> The code below doesn't compile (after I added ": IComparable" on the
> first line). Any advice on how to get it compiled?
>
> public class LongTermLimitOnBuy : LongTermLimit : IComparable
> ...


Add ", IComparable" instead of ": IComparable".

Markus
 
Reply With Quote
 
Curious
Guest
Posts: n/a
 
      14th Aug 2009
On Aug 14, 3:46*pm, Markus Betz <d...@arcor.de> wrote:
> Curious wrote:
> > The code below doesn't compile (after I added ": IComparable" on the
> > first line). Any advice on how to get it compiled?

>
> > * * public class LongTermLimitOnBuy : LongTermLimit : IComparable
> > ...

>
> Add ", IComparable" instead of ": IComparable".
>
> Markus


Thanks, It works!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compiling error CharlesCount via AccessMonster.com Microsoft Access Getting Started 4 16th Dec 2007 03:05 AM
Re: Error Compiling Cor Ligthert [MVP] Microsoft VB .NET 0 20th Jul 2006 03:23 AM
RE: Error Compiling =?Utf-8?B?aXdkdTE1?= Microsoft VB .NET 1 19th Jul 2006 08:33 PM
compiling error, =?Utf-8?B?VmljVmlj?= Microsoft VC .NET 2 11th Aug 2005 04:59 PM
compiling error creimke Microsoft Excel Misc 2 6th Feb 2004 01:13 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:02 PM.