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
kamal
NA
1
2.6k
generics
Sep 16 2010 4:01 PM
how to add two integer and float variables?
class genericclass<T>
{
private T a;
private T b;
public void sum(T val1, T val2)
{
Console.WriteLine(" sum is "+ (val1 + val2));
}
}
class Program
{
static void Main(string[] args)
{
genericclass<int> gcint1= new genericclass<int>;
gcint1.sum(2, 3);
genericclass<float> gcfloat1=new genericclass<float>;
gcfloat1.sum(2.0, 3.0);
}
}
Reply
Answers (
1
)
How to create Web scraper with login
The problem with sending mail