betterc-interface 1.0.1
Interfaces and Dynamic Casts for betterC classes.
To use this package, run the following command in your project's root directory:
						Manual usage
						
						Put the following dependency into your project's dependences section:
					
betterc-interfaces
Provides interface compatibility to D -betterC flag. Poymorphism and dynamic casts on betterC!
What it can do
- Implement multiple interfaces
 - Dynamic casts
 - Inheritance
 
Limitations
- Can't define a new destructor
 - Usage of 
interfacesis done viaabstract classinstead of interface itself. This happens because simply by usinginterfacekeyword, D refuses to build. opCastcan't be defined as of now, usegetInterface!T. This happens because opCast breaksemplace, so, you won't be able to allocate a new class.- If your constructor has parameters, you won't be able extend that class with 
CppExtendit (unless you do a default params constructor) - Needs to call getInterface! for functions accepting super class when using 
CppExtend: 
interface IInterfaceA {}
interface IInterfaceB {}
class Test : CppInterface!(Test, IInterfaceA){}
class Test2 : CppExtend!(Test2, Test, IInterfaceB){}
void test(Test t){}
Test2 t = New!Test2();
test(t); //Fails
//Instead, use:
test(t.getInterface!Test);
Example Usage:
extern(C++)
{
	///Interface
	abstract class Printable
	{
		void print();
	}
	///Interface
	abstract class Stringificable
	{
		extern(D) string toString2();
	}
	///New class implementing Printable and Stringificable classes
	class Test : CppInterface!(Test, Printable, Stringificable)
	{
		void print()
		{
			import core.stdc.stdio;
			printf("toString on print function: %s\n", toString2.ptr);
		}
		extern(D) string toString2()
		{
			return __traits(identifier, Test);
		}
	}
	abstract class DoIt
	{
		void doIt();
	}
	///Extend and include new interface
	class Test2 : CppExtend!(Test2, Test, DoIt)
	{
		void doIt()
		{
			import core.stdc.stdio;
			printf("Done it!\n");
		}
	}
	///Simply extend existing class with interface
	class Test3 : Test
	{
	}
}
extern(C) void main()
{
	Test2 t = New!Test2();
	t.print;
	t.doIt();
}
- 1.0.1 released 2 years ago
 - MrcSnm/betterc-interfaces
 - BSL-1.0
 - Copyright © 2023, Hipreme
 
- Authors:
 - Dependencies:
 - none
 - Versions:
 - 
						
Show all 4 versions1.0.1 2023-Jan-02 1.0.0 2023-Jan-02 ~master 2023-Jan-02 ~main 2023-Jan-02  - Download Stats:
 - 
						
- 
								
0 downloads today
 - 
								
0 downloads this week
 - 
								
3 downloads this month
 - 
								
12 downloads total
 
 - 
								
 - Score:
 - 0.9
 - Short URL:
 - betterc-interface.dub.pm