Hi,
I have decided to learn C# and since I have good knowledge of C++, I hope it would be easy.
I have faced an error I dont understand. It says Polygon' does not contain a constructor that takes '1' arguments (CS1729) AFAICS, all is well and constructor does take one argument. So C# maverick, help me on this as I'm confused.
Thanks

using System;

class Polygon{
	string polygonName;
	Polygon(string pName){
		polygonName = pName;	
	}	

	public string getName(){
		return polygonName;	
	}	

}

class MainClass{
	public static void Main(){
		Polygon pg = new Polygon("Iam a Triangle");	
		Console.WriteLine(pg.getName());
	}
}

added public to a constructor and it worked.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.