一个类可以在c ++中声明为静态的吗? [英] Can a class be declared static in c++?

查看:79
本文介绍了一个类可以在c ++中声明为静态的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在c ++中这是合法的(是的,我知道它是合法的.net),如果是,如何/为什么会被使用?

Is this legal in c++ (yes i know it's legal in .net), and if so, how/why would it be used?

static class foo{  
    public:  
        foo();  
        int doIt(int a);   
};


推荐答案

如果使用C ++ / CLI, static 的语法为

If you're using C++/CLI, the actual syntax for static is

ref class Foo abstract sealed /* abstract sealed = C# static */
{
};

这篇关于一个类可以在c ++中声明为静态的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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