Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > C/C++: Общие вопросы > Физическая реализация С++.


Автор: xlat 24.7.2004, 19:24
Question in English:
Please tell, how the C++ objects are represented in the memory. Please, draw scheme of situation of different parts of object instance (fields and VMT-pointer) of class CDerived (see the code below) in the memory. If this will not be any trouble, please, send the answer to pflojd@yandex.ru

class CBase
{
public:
CBase() {;}
virtual void Do_smth()
{printf("Inside the parent''s do something.\n");}
};

class CDerived: public CBase
{
public:
CDerived() {;}
virtual void Do_smth()
{printf("Inside the child''s do something.\n");}
virtual void Do_something_more()
{printf("Doing something more\n");}
};

void main()
{
class CDerived * the_object = new CDerived;
}

Question in russian:
Пожалуйста расскажите, как C++ объекты представляются в памяти. Нарисуйте схемку размещения частей объекта (полей и указателей на ТВМ) класса CDerived (код смотрите ниже). Если это не составит проблему, ответ пришлите на pflojd@yandex.ru

class CBase
{
public:
CBase() {;}
virtual void Do_smth()
{printf("Inside the parent''s do something.\n");}
};

class CDerived: public CBase
{
public:
CDerived() {;}
virtual void Do_smth()
{printf("Inside the child''s do something.\n");}
virtual void Do_something_more()
{printf("Doing something more\n");}
};

void main()
{
class CDerived * the_object = new CDerived;
}

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)