YvonneTsang
Programmer
I was wondering if you are able to create a variant public variable in a class. I have a class that one of the variables can be set to one and only 1 of 4 different types/classes. Am I able to do this? Should I just have the other classes inherit from my main class? What is the easiest way to approach this problem? I am new to C# and it has been ages since I did Java so I am having trouble remembering what to do.
Essentially:
class MainOne
{
public string type;
public variant info;
public MainOne(string typedetails)
{
type = typedetails
if (type = "a"
{
info = new a()
}
etc
}
class a
class b
class c
class d
All of these classes will write to a seperate SQL table and I want to keep it easy to work with and only have 1 class write to each table. Thanks in advance for all of your help.
Essentially:
class MainOne
{
public string type;
public variant info;
public MainOne(string typedetails)
{
type = typedetails
if (type = "a"
{
info = new a()
}
etc
}
class a
class b
class c
class d
All of these classes will write to a seperate SQL table and I want to keep it easy to work with and only have 1 class write to each table. Thanks in advance for all of your help.