Y
yuriy_zubarev
Greetings,
I have 2 classes:
abstract class Abstract
{
public Abstract()
{
}
public Abstract(string name): this()
{
}
}
class Impl: Abstract
{
public Impl(): base()
{
// Some important code
}
public Impl(string name): base(name)
{
}
}
While doing the following, the constructor with "Some important code"
doesn't get invoked:
Abstract obj = new Impl("cute name");
What's the proper way of organizing classes in this case? I need code
from Impl() constructor to be invoked when instantiating a class by
using Impl(string) constructor and of course, constructors from
abstract class shouldn't be forgotten either.
Thank you for your time.
Regards.
I have 2 classes:
abstract class Abstract
{
public Abstract()
{
}
public Abstract(string name): this()
{
}
}
class Impl: Abstract
{
public Impl(): base()
{
// Some important code
}
public Impl(string name): base(name)
{
}
}
While doing the following, the constructor with "Some important code"
doesn't get invoked:
Abstract obj = new Impl("cute name");
What's the proper way of organizing classes in this case? I need code
from Impl() constructor to be invoked when instantiating a class by
using Impl(string) constructor and of course, constructors from
abstract class shouldn't be forgotten either.
Thank you for your time.
Regards.