Home Using an object in a single class with multiple constructors
Reply: 0

Using an object in a single class with multiple constructors

user1379
1#
user1379 Published in April 26, 2018, 7:43 am

This is the class that I build the constructors in, I want to have multiple "UserKeys" constructors, 1 for each character in my project but the main class doesn't recognize the second constructor only the first one (if I have a constructor that takes 0 arguments, it recognizes that and the first one, but not the second one)

abstract class BaseKeys
{
    public abstract bool LeftPressed();
    public abstract bool RightPressed();
    public abstract bool UpPressed();
    public abstract bool DownPressed();
    public abstract bool high_hitPressed();
    public abstract bool rope_jumpPressed();
    public abstract bool runRightPressed();
    public override bool leftRightPressed();
}

class UserKeys : BaseKeys
{
    #region data
    Keys left, right, up, down, walk;
    Keys combo, high_hit;
    #endregion

    #region ctor
    public UserKeys(Keys left, Keys right,
                    Keys up, Keys down, Keys high_hit)
    {
        this.left = left;
        this.right = right;
        this.up = up;
        this.down = down;
        this.high_hit = high_hit;
    }

    public UserKeys(Keys right, Keys left, 
                    Keys down, Keys walk, Keys high_hit)
    {
        this.left = left;
        this.right = right;
        this.down = down;
        this.high_hit = high_hit;
        this.walk = walk;
    }
}
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.422981 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO