TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Manpreet singh
NA
3
2.1k
can anyone resolve error in this operator overloading problem ??
Dec 7 2012 12:57 PM
class Distance
{
int dist;
public Distance(int d)
{
this.dist = d;
}
public static Distance operator +(Distance d1, Distance d2)
{
return new Distance(d1.dist + d2.dist);
}
}
class Program
{
static void Main(string[] args)
{
Distance d1 = new Distance(3);
Distance d2 = new Distance(10);
Distance d3;
d3 = d1 + d2;
int a = (int)d3;
Console.WriteLine(a);
Reply
Answers (
2
)
How could i gnerate rndm unique data via stringarray C#
returning largest int variable from object