Forgive me if I confuse you with this question.
Please ask for more details, and I will try to explain better.
I have a program in C# that is using an interface, base class, and derived class.
The base class is built using an interface contract.
The derived classes are of a similar type, all derived by the same base class, in turn using that same interface contract.
I want to do something similar to the following.
I understand that this code will not compile.
I just slapped this together really quick to get my point across.
What will happen when the base variable is printed to the screen?
Does the base object get erased and repopulated with the second binding?
Code:
//base class
int FooBar = 0;
public Foo(int bar)
{
if (bar == 5)
FooBar == bar;
}
Code:
//dirived class 1
int FooBar = 0;
public Bla1()
{
base.constructor(5)
}
Code:
//dirived class 2
int FooBar = 0;
public Bla2()
{
base.constructor(6)
}
Code:
Foo BlaBase;
BlaBase = new Bla1();
cout<<BlaBase.FooBar;
BlaBase = new Bla2();
cout<<BlaBase.FooBar;