0

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());
	}
}
1
Contributor
1
Reply
4
Views
6 Years
Discussion Span
Last Post by Stefano Mtangoo
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.