techker
New member
- Joined
- Jan 16, 2016
- Messages
- 4
- Programming Experience
- 1-3
Hey guy's i just came out of school and in my internship..i have a little project to test the events args and polymorphisme..Here are the req:
need to create and abstract class CustomEventArgs:Event Args
with public virtual string Hello
then he says i need to create a class Custom1:event args
in it override string Hello = Hello welcome..
the custom2
override hello = Hello Welcome Home
custom3
override hello = Welcome to main
so then i need to create 3 buttons with an event handler that writes a label with the text of the override..
so im confused on how to call the class custom to write tto label?
i got
need to create and abstract class CustomEventArgs:Event Args
with public virtual string Hello
then he says i need to create a class Custom1:event args
in it override string Hello = Hello welcome..
the custom2
override hello = Hello Welcome Home
custom3
override hello = Welcome to main
so then i need to create 3 buttons with an event handler that writes a label with the text of the override..
so im confused on how to call the class custom to write tto label?
i got
C#:
namespace Work1
{
public partial class Form1 : Form
{
public delegate void EventHandler();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
public abstract class CustomEventsArgs : EventArgs
{
public abstract string Message();
}
class Custom1 : EventArgs
{
public string Message { get; set; }
public override string ToString()
{
return Message="Welcome";
}
}
class Custom2 : EventArgs
{
public string Message { get; set; }
public override string ToString()
{
return Message = "Welcome2";
}
}
class Custom3 : EventArgs
{
public string Message { get; set; }
public override string ToString()
{
return Message = "Welcome3";
}
}
private void button1_Click(object sender, EventArgs e)
{
call event handler...
}
}
}