联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2023-05-27 01:34

ECS 36b Homework #5 (programming, 5%)

For this homework, we will experiment programs related to memory. This is a two-persons team project.

Your task is to write a C++ program such that it will create an IOT_Thing object, like in ml_IOT_Thing.cpp, and your

program will print the addresses of every component (vtable pointers for each of child/parent/grandparent classes, and the

attributes). You need to go through the same process for the following four cases –

(1) Single inheritance, (2) Single Virtual Inheritance, (3) Multiple Inheritance (both Thing and Another_Thing), and

finally (4) Virtual Inheritance involving both Thing and Another_Thing.

For each case, you should have a separate program. And, your output should be similar to the Clang tool we presented in

the class, but you need to add memory addresses to each LINE of the output below –

g++ -cc1 -std=c++14 -fdump-record-layouts …

*** Dumping AST Record Layout

0 | class IOT_Thing

0 | (IOT_Thing vtable pointer)

8 | class IP_Address connected

8 | unsigned int addr

48 | class Core (virtual base)

48 | unsigned int class_id

16 | class Thing (virtual base)

16 | (Thing vtable pointer)

24 | unsigned int model

28 | unsigned int sequence_num

32 | class GPS_DD location

32 | double latitude

40 | double longitude


相关文章

版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp