J
Jeroen Ceuppens
Hi,
I want to write a function Cast() so I can use the if else if,... structure
everywhere in my program, but If I write a Cast() function, it must return
something, but how can you declare a funtion without knowing what the return
object type will be?
So public VOID Cast(LijstNode help) isn't possible, but if I change void to
LijstNode the Cast function will be useless (GetImageNode, ViewNode, ... are
derived from Lijstnode (is derived from TreeNode)), hope you can give me
some tips to fix this
Thx
See below the code.
private void buttonVoegToe_Click(object sender, System.EventArgs e)
{
LijstNode copy;
copy=(LijstNode)treeViewOverview.SelectedNode;
if ( copy is GetImageNode )
{
GetImageNode h = (GetImageNode)copy;
AddToLastNode(h);
}
else if ( copy is ViewNode )
{
ViewNode h = (ViewNode)copy;
AddToLastNode(h);
}
else if ( copy is CastNode )
{
CastNode h = (CastNode)copy;
AddToLastNode(h);
}
else if ( copy is FilterNode )
{
FilterNode h = (FilterNode)copy;
AddToLastNode(h);
}
else if ( copy is TimerNode )
{
TimerNode h = (TimerNode)copy;
AddToLastNode(h);
}
}
I want to write a function Cast() so I can use the if else if,... structure
everywhere in my program, but If I write a Cast() function, it must return
something, but how can you declare a funtion without knowing what the return
object type will be?
So public VOID Cast(LijstNode help) isn't possible, but if I change void to
LijstNode the Cast function will be useless (GetImageNode, ViewNode, ... are
derived from Lijstnode (is derived from TreeNode)), hope you can give me
some tips to fix this
Thx
See below the code.
private void buttonVoegToe_Click(object sender, System.EventArgs e)
{
LijstNode copy;
copy=(LijstNode)treeViewOverview.SelectedNode;
if ( copy is GetImageNode )
{
GetImageNode h = (GetImageNode)copy;
AddToLastNode(h);
}
else if ( copy is ViewNode )
{
ViewNode h = (ViewNode)copy;
AddToLastNode(h);
}
else if ( copy is CastNode )
{
CastNode h = (CastNode)copy;
AddToLastNode(h);
}
else if ( copy is FilterNode )
{
FilterNode h = (FilterNode)copy;
AddToLastNode(h);
}
else if ( copy is TimerNode )
{
TimerNode h = (TimerNode)copy;
AddToLastNode(h);
}
}