IRC Networks
Irc Logs Stats
Start date: 2007-09-27 02:48:27
Last update: 2008-04-02 18:00:08
Channels: 41
Logged Lines: 6229042
Size: 1806.44 MB
Powered by
Channel Info
Network: freenodeChannel: #csharp |
Search in www.irclog.org
Log from #csharp at freenode 2006-06-14
[00:05]<trc>LOL
[00:08]<[r]>if i'm makikng object C which extends object B which extends object A and a method is in all 3 objects and I want to call A's version from C w/o calling B's... is that possible?
[00:08]<azyfm>nope
[00:09]<[r]>seems like something that would be popular
[00:09]<azyfm>not really
[00:09]<azyfm>B being derived from A is an internal implementation detail of B
[00:09]<azyfm>more or less
[00:09]<kjr>Arild: if he wants to call base ;)
[00:10]<[r]>what about this
[00:10]<[r]>B has a method named Bob, if i override that in C, and another method from B gets called, will it use the one from C or B?
[00:10]<syfyvyaw>i need a crash about how to use xml as data sources cause right now im damned confused
[00:11]<[r]>the other method from B calls Bob*
[00:11]<syfyvyaw>*crashcourse
[00:12]<y-gz>i think when it comes to virtual methods
[00:12]<y-gz>the one in the top implementation get's called
[00:12]<y-gz>I am confused there too
[00:12]<y-gz>imagine you access the virtual method trough an interface
[00:12]<y-gz>what happens then
[00:12]<y-gz>:d
[00:13]<gjrvcxnne>If C derives from B, and both C and B have method Bob, if you cast an instance of a C object to a B object, and Call bob, does it call C.Bob or B.Bob
[00:14]<[r]>i hate objects... i hate inheritance
[00:14]<vynvyv>GoatCheez: won't that be a cast exception?
[00:14]<gjrvcxnne>( i would think it still calls C.Bob)
[00:14]<vynvyv>oh nm
[00:14]<vynvyv>wtf did you explain i tthat way?
[00:14]<gjrvcxnne>i dunno
[00:14]<kjr>GoatCheez: I'll send that link to my dad... see what his take on it is. He always said Dvorak was a bit of an ass ;)
[00:14]<vynvyv>maybe we think differently, but i'd normally say B derives from C
[00:15]<ausvyg_>GoatCheez, it depends on how Bob was defined in C, I should think
[00:15]<gjrvcxnne>Dvorak is a retard lol
[00:15]<vynvyv>anyway, it will call C.Bob
[00:15]<kjr>dunno bout that
[00:15]<ausvyg_>GoatCheez, since there are things like 'new' and 'override'
[00:15]<gjrvcxnne>ok, here's it put better
[00:15]<vynvyv>is dvorak the keyboard guy?
[00:15]<azyfm>'new' doesn't play with polymorphism, at all
[00:16]<gjrvcxnne>uhh yeah
[00:16]<gjrvcxnne>lol
[00:16]<[r]>wow
[00:16]<vynvyv>GoatCheez: casting has nothing to do with which method is called. That's the benefit of polymorphism
[00:16]<kjr>no, that was Dr. Dvorak... he lived a little earlier
[00:16]<[r]>this visual studio 2005 is pretty slick for debugging
[00:16]<gjrvcxnne>you can implement multiple interfaces correct?
[00:16]<kjr>yes
[00:17]<gjrvcxnne>can a class inherit two interfaces with the same method?
[00:17]<vynvyv>yes
[00:17]<vynvyv>although i haven't tested it
[00:17]<vynvyv>that's the whole reason interfaces exist in the first place
[00:17]<vynvyv>they prevent the diamond of death
[00:17]<vynvyv>(yes i'm stupid for saying yes without testing it)
[00:18]<vynvyv>i'll do something even stupider and test it in java
[00:18]<gjrvcxnne>damnit.. i don't know where i'm going with this lol
[00:18]<vynvyv>since i've got idea open :P
[00:19]<azyfm>GoatCheez - the usual way of dealing with two interfaces having a method with the same name is through explicit interface implementation
[00:19]<y-gz>if you have 2 interfaces with the same method you will need to implement them explicitly
[00:19]<azyfm>so you can have void IFoo.SomeMethod(){} and void IBar.SomeMethod(){}
[00:19]<y-gz>the interfaces
[00:19]<y-gz>yes
[00:19]<gjrvcxnne>ah, i figures a : would be there somwhere, awell lol
[00:20]<y-gz>but i think then you need to explicitly cast
[00:20]<azyfm>yes
[00:20]<vynvyv>Arild: i don't think java works that way
[00:20]<vynvyv>not that anyone in here would care
[00:20]<azyfm>IFoo.SomeMethod and IBar.SomeMethod can only be accessed through variables of type IFoo and IBar
[00:20]<azyfm>tieTYT - it doesn't
[00:21]<cfudsd>so if you implement them explicityly, how do you use them?
[00:22]<cfudsd>oic
[00:22]<cfudsd>they cacnt be accessed through the actual class? what about internally inside the class?
[00:22]<azyfm>IFoo foo = (IFoo)someObjectWhoseTypeImplementsIFooAndIBarExplicitly; foo.SomeMethod()
[00:22]<azyfm>not entirely sure, but I think you may have to cast 'this'
[00:22]<cfudsd>interesting
[00:23]<y-gz>yes you will
[00:23]<vynvyv>Arild: that is very very strange. That means that the method called depends on compile time
[00:23]<cfudsd>so (this as IFoo).SomeMEthod()
[00:23]<cfudsd>and (this as Ibar).SomeMEthod()
[00:23]<cfudsd>??
[00:23]<y-gz>yes i think
[00:23]<vynvyv>what if you make IFooBar that extends IFoo and IBar
[00:23]<vynvyv>and your class implements IFooBar?
[00:24]<azyfm>interface inheritance is a little iffy in .NET
[00:24]<y-gz>well the methods become part of IFooBar i guess ?
[00:24]<y-gz>so you will need to implement IFooBar.MyIFooMethodImplementation
[00:24]<y-gz>else you will need to share 1 implementation for both 2 methods
[00:25]<y-gz>both two interfaces
[00:25]<y-gz>not methods
[00:25]<cfudsd>when make Ifoobar, that has both interfaces, do both of those methods convert as the same?
[00:25]<vynvyv>i-nZ: that wouldn't be an interface extending two others
[00:25]<vynvyv>that would be an interface that has a method that's implying it should call a another interface
[00:26]<cfudsd>since its just a interface anyhow.. as far as Ifoobar is concerned would there by just SomeMethod, rather thao IFOO.SOmemethid and Ibar.Somemethod?
[00:26]<y-gz>i have some stuff i am doing atm with inheritance
[00:26]<gjrvcxnne>I have interfaces A and B, which has method Bob, and interfaces C and D, which extend interfaces A and B (C:A, D:B). D overrides B's implementation of Bob. Inferface E extends interfaces C and B (E:C,B). E overides Bob such that it calls the B:Bob. Class F implements interfaces E and D. What will calling _____ Do? (calls to follow)
[00:26]<y-gz>actually i need to implement stuff
[00:26]<vynvyv>interface inheritance can be useful
[00:27]<y-gz>I have a class that must implement IDesignerHost
[00:27]<gjrvcxnne>F.Bob();
[00:27]<gjrvcxnne>((A)F).Bob();
[00:27]<gjrvcxnne>((C)F).Bob();
[00:27]<y-gz>a class that needs to implement CLASS : IDesignerHost, IDesignerLoaderHost, IServiceContainer, IServiceProvider, but IDesignerHost is " public interface IDesignerHost : IServiceContainer, IServiceProvider"
[00:27]<y-gz>:)
[00:27]<gjrvcxnne>(this might be a whack excercise... not entirely sure lol)







