Thread overview | ||||||
---|---|---|---|---|---|---|
|
August 06, 2006 How to overload new operator for all classes? | ||||
---|---|---|---|---|
| ||||
I know global operator overload is not supported in D, but I hope new could be an exception.
I want to write some kernel like program in D
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
|
August 06, 2006 Re: How to overload new operator for all classes? | ||||
---|---|---|---|---|
| ||||
Posted in reply to david Attachments: | david schrieb am 2006-08-06:
> I know global operator overload is not supported in D, but I hope new
> could be an exception.
> I want to write some kernel like program in D
Simply add the operator to the Object class in
src/phobos/internal/object.d
Thomas
|
August 06, 2006 Re: How to overload new operator for all classes? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Thomas Kuehne |
Thomas Kuehne wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> david schrieb am 2006-08-06:
>
>>I know global operator overload is not supported in D, but I hope new could be an exception.
>>I want to write some kernel like program in D
>
>
> Simply add the operator to the Object class in
>
> src/phobos/internal/object.d
>
> Thomas
>
>
> -----BEGIN PGP SIGNATURE-----
>
> iD8DBQFE1ZsCLK5blCcjpWoRAo1aAJwIqfbIXXaPOceaczTFN1K3cflCwACdFmFa
> YE22zhE/7sZi4OOxymtxQTQ=
> =Iwzp
> -----END PGP SIGNATURE-----
Are costume allocators inherited by subclasses?
|
August 07, 2006 Re: How to overload new operator for all classes? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Hasan Aljudy Attachments: | 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
|
Copyright © 1999-2021 by the D Language Foundation