| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11
Comments:
<0> fstream too, right? <1> shut up :P <0> ha ha ha.. good question <2> Ok, next question: When is it needed to add virtual base cl***es to an initializer list? <0> give up <1> if they dont have a default constructor -.- <0> Run, how do we do that? <0> is it like constructor chaining? <2> Suppose we have: cl*** V; cl*** B1 : virtual V {}; cl*** B2 : virtual V {}; cl*** A : public B1, public B2 {}; And V doesn't have a default constructor. Then is it necessary to add V to the initializer list of A? <0> i dont think, interviewer will be knowing about this... :) <2> heheh <0> thanks anyways... :) <2> The answer is yes, because the compiler don't know how to initialize V: through path B1 or B2. <3> e vreun roman in aer <1> so my answer was right <1> :P
<2> Ie, B1 could have V(3) and B2 V(5) <3> why visual doesnt work fi <2> Tamama: actually, I think even if it has a default constructor, you still need to specify one. <2> But I never use virtual inheritance.. so I don't have a lot of experience with it. <1> Run: ok, i should have been more specific: if a default constructor can not be automatically chosen <1> double = cant choose, non existant = cant choose <2> The term 'default constructor' is reserved for V(void) <1> meh <1> terms schmerms <3> why <3> #include<iostream.h> <3> int a[10][10],i,j,n,m,st[67],c1,c2,x,y; <3> void citire() <3> { cin>>n>>m; <3> for(i=1;i<=n;i++) <3> a[i][i]=0; <3> for(i=1;i<=m;i++) <0> default can be V(int=0) too , right? <3> {cin>>x>>y; <3> a[x][y]=1; <3> a[y][x]=1; <3> } <1> bah <4> ;) <1> i wasnt op :S <0> :P <1> I even typed a kick message <5> wow <0> default constructor can be V(int=0) too , right? <5> that really is stretching it lol <5> um <5> int i = 0 ? <2> int=0 is ok too <2> I think <5> cool <5> how would you use that? <3> i send earlyer aprog <0> SB_, that is declaration part... <1> Well I never found the compiler randomly choosing constructors with arguments that dont default <0> in definition, we need to use a variable. <2> It would all you to call V(), and get no compiler warning if you don't use 'i' inside that constructor <1> luckely <5> DoIt, but i mean, if you have f(int = 0) as opposed to f(int i = 0), how would you use 'int = 0' in the function <1> previous statement stands then :) <5> I guess I don't see the purpose of it. <5> Run, f(void)? <6> You don't need the ***ignment in a definition. Just leave out the name of the variable if you don't use it. <0> SB_, in the function you dont need to specify the default argument <2> SB_: suppose you call f like f() and f(x), but in this particular f you don't USE the parameter... <5> agh, but why even have it <6> int foobar(int, int); /* declaration */ int foobar(int thisIsUsed, int) { std::cout << thisIsUsed; } <6> LIke that. <6> No need for the default param value. <0> same function will invoke default constructor as well as one argument constructor <3> sb wake up <4> the virtual base constructor is called based on the one invoked from the actual cl*** being instanciated <6> That should prevent a warning. <3> you are so boring <3> prevent a warning. <3> <3> you are so boring
<3> prevent a warning. <3> <3> you are so boring <3> prevent a warning. <3> <3> you are so boring <3> prevent a warning. <3> <3> you are so boring <4> the ***ist, heh <5> I mean, all that to prevent a compiler warning? <5> that's really all that is accomplishing? <0> SB_, nope <6> What I just typed does. <6> I don't know what DoIt is doing, or Run. <0> you can even have V(int=0,int=0,int=0) <5> yeah <6> All you have to do is not supply the parameter name. <6> No need for the =0 <5> f(int) ? <4> run is prepping DoIt for his interview, maybe <6> I guess <0> :) <2> Solamente: You sure you can call it as f() then? <5> Sorry for being stupid <5> I was just curious. I mean I still don't fully understand it, but that's ok. <6> Ah.... okay, we're conflating two different things. <6> I see now. <6> We're talking about two sides of one issue <5> The limit of the issue as approached from the left and the right ;) <6> You're talking about not having to supply a value on the call. <2> The question was if the syntax f(int = 0) ever made sense. <6> I'm talking about getting rid of the warning in the definition. <4> mmm, i feel like ordering pizza <5> Run, More like why do it lol <6> So what I typed above gets rid of the warning if the parameter is not used. <5> rdragon, lucky bastard, i don't have money for that.. been a while since i've had decent pizza <6> What you're describing makes the parameter unnecessary at point-of-call. <4> oh yeah, money... <6> (And gets rid of the warning) <5> rdragon, haha about that <4> well, today is payday... or tomorrow <6> So, yeah. <0> SB_, if you decare a function like A{public: A(int=0);};A::A(int i) {} , this constructor will invoke for V() and V(9); <6> I'm going to shut up now. <5> rdragon, i need a job still <2> SB_: I already said that, because it does TWO things: you don't have to (but can) supply a value on the call, AND it won't give a warning for not using the argument inside the function. <6> Yeah, I see that. <2> Ok, play time is over. <4> I can't get "the cars - hello again" out of my head... heard it on a commercial and it's been stuck <6> Man, I actually have to go to the office today. That ****s. <7> have to go? awwww, I'm already there <6> "All I Want" >>>> "Hello Again" <5> DoIt, But why not just use A(void) for when you call A()... <0> SB_, the same fucntion is getting called for both... <0> you dont need to define both functions <0> if all you need to do is same for all kind of constructors.... <5> DoIt, so i gets the default value of 0? <5> DoIt, and it does the same thing as A(int i) ? <7> why would one bother?? <2> DoIt: Where are you _allowed_ to use the typename keyword? :) <4> DoIt a virtual base gets constructed exactly once, and it uses the form of the constructor invoked from the complete object - that is, the type of the object being constructed <5> DoIt, what is it called, I'll stop wasting y'alls time and look it up :) <4> irrgardless if base cl***es have syntax for invoking other constructors of the virtual base, they're ignored <7> rdragon the _most_ derived, rdragon which makes it even messier <0> Run, no idea.... <5> hrm <4> most derived, yeah <5> so what is it called? <4> you're at the office already? that seemed quick <5> Or is that just building on a basic principle of c++ i should know? <4> Run don't prep him for his interview - either he knows what he's talking about or doesn't <5> rdragon, haha <2> DoIt: They won't ask that. But the answer is (apart from in a template argument list), inside a template definition for types that are depending on a template argument. <4> he'll be worse off if he repeats something he heard here, and then can't actually explain what it means <0> rdragon, i wont, unless i have the full concept <4> you say that
Return to
#c++ or Go to some related
logs:
#chatzone seswali DCC SEND 0 0 0 #linux import fl.fileExists flash tourist informaion bahrain
ben merve #mirc #chatzone castellano grandkids
|
|