On Monday, 17 August 2015 at 06:10:38 UTC, Rikki Cattermole wrote:
On 17/08/2015 5:57 p.m., Ozan wrote:
Hi

[...]

import std.stdio;
abstract class Family { void greeting(); }
class Dad : Family { void greeting() { writeln("I'm dad"); } }
class Boy : Family { void greeting() { writeln("I'm daddy's boy"); } }

void main() {
        Family dad = new Dad;
        Family boy = new Boy;
        dad.greeting;
        boy.greeting;
}

I'm confused how this isn't real OOP?

Replace 'real' with 'theoretical' OOP. Every instance of a class (object) is like an independent black box. Every public message (method / function) of the class definition could be called when ever you want. Variables are like pointers to objects. With inheritance and overriding you're losing in class type implementations of OOP a lot of 'theoretical' flexibility. I was asking for a possibility to avoid this.

Regards Ozan

Reply via email to