- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am still a bit unclear as to whether the COM server methods are placed in a module or not. Specifically, I would like to overload a method and the only trick I know is by way of Interface and module-procedure statements. Can this be done for the methods of a COM server??
if so, how?
Thanks in advance,
Tim
if so, how?
Thanks in advance,
Tim
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tim,
I think the concept of overloading doesn't exist in COM. You have objects that support interfaces, which are sort of a contract, and that's about it. An object can support many interfaces, but the methods and arguments to these methods are defined in the interface and fixed. Your objects either support or don't support an interface as a whole. This of course doen't stop you from implementing overloading inside your object, but this is something that has to be dealt with internally.
regards,
Marco A. Garcia
Canaima Software
P.O. Box 13162
La Jolla, CA. 92039
U.S.A.
e-mail:mgarcia@canaimasoft.com
Tel/Fax: (619) 233-6831
http://www.canaimasoft.com
Developers of f90SQL the Database Connectivity Solution for Fortran, and f90VB the Library for Fortran-OLE Automation and Fortran-VB Programming
I think the concept of overloading doesn't exist in COM. You have objects that support interfaces, which are sort of a contract, and that's about it. An object can support many interfaces, but the methods and arguments to these methods are defined in the interface and fixed. Your objects either support or don't support an interface as a whole. This of course doen't stop you from implementing overloading inside your object, but this is something that has to be dealt with internally.
regards,
Marco A. Garcia
Canaima Software
P.O. Box 13162
La Jolla, CA. 92039
U.S.A.
e-mail:mgarcia@canaimasoft.com
Tel/Fax: (619) 233-6831
http://www.canaimasoft.com
Developers of f90SQL the Database Connectivity Solution for Fortran, and f90VB the Library for Fortran-OLE Automation and Fortran-VB Programming
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Marco,
I am finding out more and more than the O in COM has little resemblence to the usual O in OOP!
First I find out that I cannot pass arg's to the "constructor" hence it's not really a constrcutor as in OOP and now you say overloading/polymorphism is out.
At least I'm glad for once that these things are not Fortran's shortcoming.
Tim
I am finding out more and more than the O in COM has little resemblence to the usual O in OOP!
First I find out that I cannot pass arg's to the "constructor" hence it's not really a constrcutor as in OOP and now you say overloading/polymorphism is out.
At least I'm glad for once that these things are not Fortran's shortcoming.
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Tim,
I didn't say polymorphism, just overloading. In COM, polymorphism (although perhaps not in the strict sense) can be achieved through the use of interfaces...
regards,
Marco A. Garcia
Canaima Software, Inc.
www.canaimasoft.com
I didn't say polymorphism, just overloading. In COM, polymorphism (although perhaps not in the strict sense) can be achieved through the use of interfaces...
regards,
Marco A. Garcia
Canaima Software, Inc.
www.canaimasoft.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry to use loose language, still:
overloading is acheived in CVF (as I understand it) only by way of interfaces. (as I mentioned byu way of Module-procedure etc). So are yousaying that there is a way to do overloading using interfaces?
Tim
overloading is acheived in CVF (as I understand it) only by way of interfaces. (as I mentioned byu way of Module-procedure etc). So are yousaying that there is a way to do overloading using interfaces?
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tim,
When I say overloading, I'm talking about function overloading. Without intention of discussing their merits, there are two concepts extensively used in OOP that are not supported in COM: function overloading and multiple inheritance. The definition of a function (method) in a COM interface cannot be overloaded. In other words, a single COM interface cannot have three methods called MyMethod, each taking different types of arguments.
Regarding polymorphism, it is possible in COM. Here is a typical example (From Inside OLE ? Brockschmidt):
A Rabbit object (which implements the IRabbit interface) is polymorphic, because it can be also treated as a general Animal (the IAnimal interface). You can call the Eat method of a rabbit object, and the same for a Koala object (implementing IKoala interface). The implementation of the Eat method, however, doesn?t have to be the same for both animals.
Note that I have been always talking about COM interfaces, do not confuse Fortran interfaces with COM interfaces. They are completely different animals
regards,
Marco A. Garcia
When I say overloading, I'm talking about function overloading. Without intention of discussing their merits, there are two concepts extensively used in OOP that are not supported in COM: function overloading and multiple inheritance. The definition of a function (method) in a COM interface cannot be overloaded. In other words, a single COM interface cannot have three methods called MyMethod, each taking different types of arguments.
Regarding polymorphism, it is possible in COM. Here is a typical example (From Inside OLE ? Brockschmidt):
interface IAnimal : IUnknown { HRESULT Eat(...); HRESULT Sleep(...); HRESULT Procreate(...); } interface IRabbit : IAnimal { HRESULT RaidGardens(...); HRESULT Hop(...); HRESULT DigWarrens(...); } interface IKoala : IAnimal { HRESULT ClimbEucalyptusTrees(...); HRESULT PouchOpensDown(...); HRESULT SleepForHoursAfterEating(...); }
A Rabbit object (which implements the IRabbit interface) is polymorphic, because it can be also treated as a general Animal (the IAnimal interface). You can call the Eat method of a rabbit object, and the same for a Koala object (implementing IKoala interface). The implementation of the Eat method, however, doesn?t have to be the same for both animals.
Note that I have been always talking about COM interfaces, do not confuse Fortran interfaces with COM interfaces. They are completely different animals
regards,
Marco A. Garcia

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page