-gc类细节

博客主要提及了 -gc 类细节相关内容,但未给出更多具体信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

-gc类细节

vc.net

1:gc类对像不能在stack上面建立.只能用new在head上面建立对像.

__gc class Sample
{
private:
    double number;
public:
    Sample( double num): number(num){};
};

 
Sample* s = new Sample(3.2);//只能这样create a instance.



2:gc类的继承只能在mangaed class中派生出来.


3:single继承


__gc class A
{
protected:
    int a;
};


__gc class B
{
protected:
    int b;
};


__gc class Sample: public A, public B  //it is wrong.
{
public:
    Sample(int x, int y) : a(x), b(y) {}
};

 

4:不能用firend关键字,让别的类可以防问mangaed class 中的private 数据.
5:mangaed class 中的数据成员不能是 unmanaged class 对象.
6:不能执行一个复制构制函数
7:不能定义new ,& 操作符.






posted on 2005-12-29 15:15 lbsjs 阅读(...) 评论(...) 编辑 收藏

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值