What I am trying to accomplish is a form of inheriting multiple classes, I tried interfaces but they are rather limited, then i tried abstract classes. Everything seemed fine but as it turns out (as i forgot) a class can only have 1 base class.
Is there a way to have a bunch of base classes and have them inherit/ be inherited ?
Below is 2 of the class files im trying to inherit.
- interface - FAILED, cant enable external acces (public) for members, cant use virtual, cant specify default values
- class (abstract) - FAILED
- layer inheriting this inherits this which inherits that, i know this is a bad idea and wouldnt work. - NOT A GOOD IDEA , FUNDAMENTALLY FLAWWED
[SPOILER]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace game
{
public class ILogical
{
public bool ShouldLogic = true;
public void Logic( float mul ) { if ( ShouldLogic ) OnLogic ( mul ); }
public virtual void OnLogic( float mul )
{
}
}
}
[/SPOILER]
[SPOILER]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace game
{
public class IRenderable
{
public bool ShouldRender = true;
public void Render( ) { if ( ShouldRender ) OnRender ( ); }
public virtual void OnRender( ) { }
}
public class IDrawable : IRenderable
{
public bool ShouldDraw { get { return ShouldRender; } set { ShouldRender = value; } }
public void Draw( ) { Render ( ); }
}
}
[/SPOILER]
Also found this, currently trying to make sense of it.
http://msdn.microsof...y/64hstbtx.aspx