How does interfaces with construct signatures work?

I am having some trouble working out how defining constructors in interfaces work. I might be totally misunderstanding something. But I have searched for answers for a good while and I can not find anything related to this. How do I implement the following interface in a TypeScript class: interface MyInterface { new ( … … Read more

How will I know when to create an interface?

I’m at a point in my development learning where I feel like I must learn more about interfaces. I frequently read about them but it just seems like I cannot grasp them. I’ve read examples like: Animal base class, with IAnimal interface for things like ‘Walk’, ‘Run’, ‘GetLegs’, etc – but I’ve never been working … Read more

Java abstract interface

Consider an example (which compiles in java) public abstract interface Interface { public void interfacing(); public abstract boolean interfacing(boolean really); } Why is it necessary for an interface to be “declared” abstract? Is there other rules that applies with an abstract interface? Finally: If abstract is obsolete, why is it included in Java? Is there … Read more

When to use Interface and Model in TypeScript / Angular

I recently watched a Tutorial on Angular 2 with TypeScript, but unsure when to use an Interface and when to use a Model for data structures. Example of interface: export interface IProduct { ProductNumber: number; ProductName: string; ProductDescription: string; } Example of Model: export class Product { constructor( public ProductNumber: number, public ProductName: string, public … Read more

Multiple Inheritance in C#

Since multiple inheritance is bad (it makes the source more complicated) C# does not provide such a pattern directly. But sometimes it would be helpful to have this ability. For instance I’m able to implement the missing multiple inheritance pattern using interfaces and three classes like that: public interface IFirst { void FirstMethod(); } public … Read more