类定义和内存分配 [英] Class definition and memory allocation

查看:125
本文介绍了类定义和内存分配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果定义代表分配内存。 C ++中的类定义在实例化对象之前没有分配内存。

If definition stands for assigning memory. How come a class definition in C++ has no memory assigned until an object is instantiated.

推荐答案

C ++类定义不分配内存。 class 就像 typedef struct 。你在哪里得到定义代表内存分配的想法?你能提供报价或参考吗?

C++ Class definitions do not assign memory. class is like typedef and struct. Where did you get the idea that "definition stands for assigning memory"? Can you provide a quote or reference?

C ++创建对象(通过 new )分配内存。

C++ Object creation (via new) assigns memory.

这篇关于类定义和内存分配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆