Jump to content
  • Advertisement
Sign in to follow this  
Kenny77

MSVS C# 2005 EE Weirdness

This topic is 3496 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I don't know if there is some part of C# that I'm unaware of that's doing this, but I find certain seemingly legit parts of code don't compile.
// Trying to declare and define an array
int[,] myArray = { { 1, 2, 3 }, { 4, 5, 6 } };
// Wouldn't compile until I changed it to:
int[,] myArray = new int[2,3] { { 1, 2, 3 }, { 4, 5, 6 } };

The weird part is when I changed that back to the first line, it then compiled fine. The first method of declaring/defining arrays is even in the MSDN documentation (I don't remember the error because it was from a while ago, and since I fixed it I didn't bother asking about it). The next issue is with inheritance.
class CMain
{
    static void Main()
    {
        
    }
}

public class AutoMobile
{
    private int price;
    private int doors;
    private int seats;
    private int hp;
    private string name;

    public AutoMobile(int price, int doors, int seats, int hp, string name)
    {
        this.price = price;
        this.doors = doors;
        this.seats = seats;
        this.hp = hp;
        this.name = name;
    }
}

public class RV : AutoMobile // No overload for method 'AutoMobile' takes '0' arguments
{

}

This compiles with the AutoMobile constructor commented out, but it doesn't with it uncommented (The error and line number is in the code).

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!