Class, constructor and inherance.

holo via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Oct 11 20:13:04 PDT 2015


>
> By the looks, I'm guessing you do not have much experience when 
> it comes to OOP.
>
> I think you are wanting something a bit closer to:
>
> import std.typecons : tuple, TypeTuple;
>
> interface Credential {
> 	string encode(....);
> }
>
> class SigV4 : Credential {
> 	this(....) {
> 		....	
> 	}
> 	
> 	string encode(....) {
> 		
> 	}
> 	
> 	private:
> 	....
> }
>
>
> TypeTuple!(string, string) AWSKeys() {
>     import std.process;
>     return tuple(environment.get("AWS_ACCESS_KEY"), 
> environment.get("AWS_SECRET_KEY"));
> }

Yes you guessed good, i don't have any experience with OOP (i 
have some experience with C - simple AVR projects and tons of 
bash scripts) this is my first such kind of language which I'm 
trying to learn. For beginning I'm trying  to avoid advanced 
things like templates or from your example touples (Touples looks 
for me like some kind of array but every cell can be different 
type, am i right? Eg tuple from your example is that same what 
string[2] var?) i was reading about it but for now i can't 
understand what they are and for what they are useful.

I'm trying to learn on the examples and honestly i'm not 
understand how that TypeTuple is resolving my problem with 
default values for classes?

Second thing that interfaces, are they needed? Without it you can 
write same function just compilator wont be screaming for it lack.


More information about the Digitalmars-d-learn mailing list