hi every one, we for an STL container we can use both iterator or indexing method to access the container data, but still y iterators are preferred i mean what is advantage of using iterator over legecy indexing... please answer me... if u feel silly still iam the begineer and even tried to google but didnt found the destiny..
hawk23reddy
Posts
-
difference b/w iterators and indexing for STL -
free and delete[]hi all, people may feel that the question what i ask is very basic but guess what i didnt found the right answer for this thats the reason i am posting here so please help me... 1. when we allocate 50bytes of memory via malloc or new and while using free or delete[] on this variable how does it knows to delete all those 50 blocks..... 2.
int i = 10; int &a = i; a = 30;
how does compiler knows that it need to change the value of i to 30. please help me....... -
sizeof related in c/c++hi thankx for answer but y for int (or types) the parenthesis is required is there any conceret reason
-
sizeof related in c/c++hi all, i am sorry i dont know weather i could ask this question ornot coz, these r the thinks always run in my mind. since we call sizeof as operator but y does we use it as sizeof(type) as a function... plese if any buddy finds it silly forgive me i even tried with google i didnt find it out..
-
using container class for c++ class objects;) :doh: :sigh: :doh: thankx,, what to do myan iam poor in lang...
-
using container class for c++ class objectshello pallini :rose:, i know google is there then y is code project is there c i can even post here right which i fell is the best so never try to answer like this is u dont feel of answering then please never ever try. ( i belive in code project and myself and also internet so no need of ur answers any more)hope u got what i mean. then if google is there then y code project is needed ? :mad:
-
using container class for c++ class objectshi, i know how to count number of objects created for class using static variable, but i came to know that there is other way i.e using container class, can any one specify how it is and if any code it will be helpfull or even links are accepted.. iam attending interviews these questions asked for me.. so please helpme.. ( i answered this but dont know how to write code for this).
-
segmentation fault issue in derived class assigment [modified]thank u. i got it..
-
segmentation fault issue in derived class assigment [modified]hi this code causes segmentation fault can u pleases y.
class ab
{
public:
virtual void abb()=0;
};
class bc : public ab
{
public:
void abb()
{
cout<<"here";
}
};
void get(ab* c)
{
bc *cc = new bc();
c = cc;//i know this is culprit
}
int main()
{
ab *b = NULL;
get(b);
b->abb();
}but how can i solve this so that i need to fill derived class object (reference or pointer) to base class in get function only.. [my request]:confused: if u feel iam very poor in basics for give me plz by only this i can learn more and attain like u [/my request] :((
modified on Tuesday, May 19, 2009 2:03 AM
-
default arguments resolutionjoe, but y is it sets the argument to base function signature arguments..
-
sizeof function resolutionYork, can u hint how to do it.. plz..
-
default arguments resolutionconsider the below code
class ab
{
public:
virtual void foo(int a = 2) = 0;
};
class ba : public ab
{
public:
void foo(int a = 4){std::cout<this will print me 2 i.e base class signature is used so is default arguemts are resolved during complie time or runtime and why is the above doing so { but i was excepting it to be 4 (derived default)}
-
sizeof function resolutionhi if using sizeof function will this be resolved during 1. runtime 2. compile time 3. pre-compile time please give me answers