Aurel
Member
- Joined
- Sep 13, 2022
- Messages
- 6
- Programming Experience
- Beginner
Hi there,
First things first, I'm using C# Core 7 preview not C#6 (not available in the list but it's whatever).
So I create a basic interface :
	
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
and I have classes impenting this. Example :
	
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
My question is, why can't I make a method public static Hexagon Create(Point location, int radius) ? since it's returns Hexagon, which implements IRegularPolygon ?
Thanks for your answers in advance !
Aurélien.
	
		
			
		
		
	
				
			First things first, I'm using C# Core 7 preview not C#6 (not available in the list but it's whatever).
So I create a basic interface :
			
				C#:
			
		
		
		public interface IRegularPolygon
{
    static readonly int SideCount;
    public RectangleF Bounds { get; }
    public IList<PointF> Points { get; }
    
    public static abstract IRegularPolygon Create(Point location, int radius);
    public static abstract Point GetCentroid(PointF[] points);
}and I have classes impenting this. Example :
			
				C#:
			
		
		
		class Hexagon : IRegularPolygon
{ 
// More codelines
     public static IRegularPolygon Create(Point location, int radius)
    {
        // Creating the Hexagon
    }
    
}My question is, why can't I make a method public static Hexagon Create(Point location, int radius) ? since it's returns Hexagon, which implements IRegularPolygon ?
Thanks for your answers in advance !
Aurélien.
 
	 
 
		 
					
				 
 
		 
 
		 
 
		