> This is an interview question asked in Robo.
How the memory address moves in Heap and stack?
That I knew it, Heap upper to lower and in stack lower to upper.
This is not correct. It depends on the platform. For example, on a
HP-UX (PA-RISC architecture) stack grows lower address to higher
address while on Intel x86 platforms the stack grows from higher to
lower addresses.
Then the next quotation was why?
(I need answer to this question)
I told them that, this is because sack keep on growing and the latest
record must be retrieved so it is like that. But I don't think it is
the right answer to that question. Can any one tell me the answer to
this question?
This would be best answered in a newsgroup of the relavant platform.
What is the diamond problem in C++?
Diamond inheritance.
class Base_Class {
// ...
};
class Derived_L : public Base_Class {
// ...
};
class Derived_R : public Base_Class {
// ...
};
class Most_Derived : public Derived_L, public Derived_R {
// ...
};
In the inheritance heirarchy given above, the "Most_Derived" class
would have 2 copies of the "Base_Class". This is overcome by virtual
inheritance from Base_Class.
class Derived_L : virtual public Base_Class {
// ...
};
class Derived_R : virtual public Base_Class {
// ...
};
Srini