class OtherClass
{
...
};
class Test
{
OtherClass otherClass;
};
int main()
{
Test *pTest = new Test;
}
pTest points to an object of type Test. Is otherClass allocated on heap aswell or in the stack?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Creates an
Testobject on Freestore(Heap), and all the members ofTestare also on the same.So Yes.
Note that technically, the standard never uses the terms Heap or stack but yes you can assume those because almost all implementations use them.