public class bar
{
public bar(list<int> id, String x, int size, byte[] bytes)
{
...
}
}
public class Foo: Bar
{
public Foo(list<int> id, String x, someEnumType y):
base(id, x, sizeof(someEnumType), y)
{
//some functionality
}
}
As you see in the above code I need to convert someEnumType to byte array type before calling base class constructor. Is there a way to do it? Something like:
public class Foo: Bar
{
public Foo(list<int> id, String x, someEnumType y)
{
//someEnumType to byte array
base(...)
}
}
Just create a method in your derived class and call it....
public class bar
{
public bar(list<int> id, String x, int size, byte[] bytes)
{
...
}
}
public class Foo: Bar
{
public Foo(list<int> id, String x, someEnumType y):
base(id, x, sizeof(someEnumType), Convert(y))
{
//some functionality
}
public static byte[] Convert(SomeEnumType type)
{
// do convert
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With