How to overload new operator for all classes?

Thomas Kuehne thomas-dloop at kuehne.cn
Sun Aug 6 22:32:04 PDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hasan Aljudy schrieb am 2006-08-06:
> Are costume allocators inherited by subclasses?

# import std.stdio;
# 
# class A{
#     new(size_t size){
#         writefln("new(%s)", size);
#         return new byte[size];
#     }
# }
# 
# class B : A{
#     int dummy;
# }
# 
# int main(){
#     writef("new A: ");
#     A a = new A();
#     
#     writef("new B: ");
#     B b = new B();
# 
#     return 0;
# }

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFE1tzbLK5blCcjpWoRAsLzAJ9NXAM5o1JQeD+l1sm5jxN9iBGY8gCgpPNE
d1WRyGfm6ZovD60vZ8pIaH8=
=YwUc
-----END PGP SIGNATURE-----



More information about the Digitalmars-d-learn mailing list