partial class

BCS ao at pathlink.com
Fri Oct 31 17:26:34 PDT 2008


Reply to Brian,

> class A {
> int someMember;
> public void init(int x) { someMember = x; }
> }
> // Far, far apart
> 
> class B : A {
> public int getSomeMember() { return someMember; }
> }
> void main() {
> auto someA = new B;
> someA.init(12);
> writefln(someA.getSomeMember());
> }
> // Partial class don't seem useful to me. It seems to me they would
> create more problems then they could solve.
> 

not that I want partial classes


// In a lib you are using

A Foo(){ return new A(); }

// your code

auto foo = Foo();

/// now call getSomeMember on foo





More information about the Digitalmars-d mailing list