Re: Class, constructor and inherance.

2015-10-15 Thread holo via Digitalmars-d-learn
Thank you for example. I asked about it programmers at work too - PHP guys - and they explained me how you are see usage of that interfaces in my code. They prepare for me some "skeleton" on which i will try to build my solution. Will be back if i will have some code.

Re: Class, constructor and inherance.

2015-10-15 Thread Rikki Cattermole via Digitalmars-d-learn
On 16/10/15 4:14 PM, holo wrote: I created interface IfRequestHandler it is used only by one class RequestHandlerXML right now but thanks to such solution i can create more classes with same interface which can handle it in different way.. eg second can be RequestHandlerCSVReport or

Re: Class, constructor and inherance.

2015-10-15 Thread holo via Digitalmars-d-learn
I created interface IfRequestHandler it is used only by one class RequestHandlerXML right now but thanks to such solution i can create more classes with same interface which can handle it in different way.. eg second can be RequestHandlerCSVReport or RequestHandlerSendViaEmail. Is it this what

Re: Class, constructor and inherance.

2015-10-14 Thread holo via Digitalmars-d-learn
I want to ask you for advises what i could do with that class to make it looks more "pro"/elegant/build in "proper way". Probably there are lot of mistakes which all beginners are doing. eg.: Did i use interface correctly? You are reasonably close: credential sig = new sigv4(); Why are

Re: Class, constructor and inherance.

2015-10-14 Thread holo via Digitalmars-d-learn
Just some ideas: interface RequestResult { ... } RequestResult go(string[string] requestParameters) Basically it is same what you wrote in one of first posts. Interface is for declaration of methods which need to be implemented in class. How in that case is it possible to return

Re: Class, constructor and inherance.

2015-10-14 Thread Rikki Cattermole via Digitalmars-d-learn
On 15/10/15 4:45 PM, holo wrote: Just some ideas: interface RequestResult { ... } RequestResult go(string[string] requestParameters) Basically it is same what you wrote in one of first posts. Interface is for declaration of methods which need to be implemented in class. How in that case

Re: Class, constructor and inherance.

2015-10-14 Thread holo via Digitalmars-d-learn
Please again, any example? I'm trying to figure out how it should be done but i don't have any base from which i can build some solution. #!/usr/bin/rdmd import std.stdio; interface RequestResult { int add (int x); } class B : RequestResult { int add(int x) {

Re: Class, constructor and inherance.

2015-10-14 Thread Rikki Cattermole via Digitalmars-d-learn
On 15/10/15 8:15 AM, holo wrote: I want to ask you for advises what i could do with that class to make it looks more "pro"/elegant/build in "proper way". Probably there are lot of mistakes which all beginners are doing. eg.: Did i use interface correctly? You are reasonably close:

Re: Class, constructor and inherance.

2015-10-14 Thread Rikki Cattermole via Digitalmars-d-learn
On 15/10/15 5:43 PM, holo wrote: Please again, any example? I'm trying to figure out how it should be done but i don't have any base from which i can build some solution. #!/usr/bin/rdmd import std.stdio; interface RequestResult { int add (int x); } class B : RequestResult {

Re: Class, constructor and inherance.

2015-10-13 Thread Rikki Cattermole via Digitalmars-d-learn
On 13/10/15 5:17 PM, holo wrote: On Tuesday, 13 October 2015 at 02:03:46 UTC, Rikki Cattermole wrote: On 13/10/15 5:56 AM, holo wrote: @Rikki: If you didn't need to make it easily changeable I would say not even bother with OOP at all. Basically that what i had was enough for me and on top

Re: Class, constructor and inherance.

2015-10-12 Thread holo via Digitalmars-d-learn
@Rikki: If you didn't need to make it easily changeable I would say not even bother with OOP at all. Basically that what i had was enough for me and on top of that i could build my app. It need to just periodically check for new instances and if they are started or stopped and count "up and

Re: Class, constructor and inherance.

2015-10-12 Thread Rikki Cattermole via Digitalmars-d-learn
On 13/10/15 5:56 AM, holo wrote: @Rikki: If you didn't need to make it easily changeable I would say not even bother with OOP at all. Basically that what i had was enough for me and on top of that i could build my app. It need to just periodically check for new instances and if they are

Re: Class, constructor and inherance.

2015-10-12 Thread holo via Digitalmars-d-learn
On Tuesday, 13 October 2015 at 02:03:46 UTC, Rikki Cattermole wrote: On 13/10/15 5:56 AM, holo wrote: @Rikki: If you didn't need to make it easily changeable I would say not even bother with OOP at all. Basically that what i had was enough for me and on top of that i could build my app.

Re: Class, constructor and inherance.

2015-10-11 Thread Meta via Digitalmars-d-learn
On Monday, 12 October 2015 at 02:14:35 UTC, holo wrote: class credential { auto accessKey = environment.get["AWS_ACCESS_KEY"]; auto secretKey = environment.get["AWS_SECRET_KEY"]; } class sigv4 : credential { private: const algorithm = "AWS4-HMAC-SHA256";

Re: Class, constructor and inherance.

2015-10-11 Thread Ali Çehreli via Digitalmars-d-learn
On 10/11/2015 08:26 PM, holo wrote: > On Monday, 12 October 2015 at 02:30:43 UTC, Meta wrote: >> On Monday, 12 October 2015 at 02:14:35 UTC, holo wrote: >>> class credential >>> { >>> auto accessKey = environment.get["AWS_ACCESS_KEY"]; >>> auto secretKey =

Re: Class, constructor and inherance.

2015-10-11 Thread holo via Digitalmars-d-learn
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() {

Re: Class, constructor and inherance.

2015-10-11 Thread anonymous via Digitalmars-d-learn
On Monday 12 October 2015 07:28, Ali Çehreli wrote: > For example, you cannot get current time at run time. I think you mean compile time here.

Re: Class, constructor and inherance.

2015-10-11 Thread Ali Çehreli via Digitalmars-d-learn
On 10/11/2015 10:35 PM, anonymous wrote: On Monday 12 October 2015 07:28, Ali Çehreli wrote: For example, you cannot get current time at run time. I think you mean compile time here. Thanks. :) Ali

Re: Class, constructor and inherance.

2015-10-11 Thread holo via Digitalmars-d-learn
On Monday, 12 October 2015 at 02:30:43 UTC, Meta wrote: On Monday, 12 October 2015 at 02:14:35 UTC, holo wrote: class credential { auto accessKey = environment.get["AWS_ACCESS_KEY"]; auto secretKey = environment.get["AWS_SECRET_KEY"]; } class sigv4 : credential {

Re: Class, constructor and inherance.

2015-10-11 Thread Rikki Cattermole via Digitalmars-d-learn
On 12/10/15 4:13 PM, holo wrote: 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 {

Class, constructor and inherance.

2015-10-11 Thread holo via Digitalmars-d-learn
Hello I'm trying to write my first class. I want to use it as module and build anothers on top of it. I read that default functions attributes are not inherited. Is it that same for constructor? This is how my class (not finished) is looking right now: class credential { auto

Re: Class, constructor and inherance.

2015-10-11 Thread Rikki Cattermole via Digitalmars-d-learn
On 12/10/15 3:14 PM, holo wrote: Hello I'm trying to write my first class. I want to use it as module and build anothers on top of it. I read that default functions attributes are not inherited. Is it that same for constructor? This is how my class (not finished) is looking right now: class

Re: Class, constructor and inherance.

2015-10-11 Thread holo via Digitalmars-d-learn
On Monday, 12 October 2015 at 03:29:12 UTC, Rikki Cattermole wrote: On 12/10/15 4:13 PM, holo wrote: 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