本文介绍了Visual C ++接口问题-在最终在类本身中定义了所有方法之后,接口的需求是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Visual C ++的初学者.我正在研究接口.我什么都没有.
假设

I am beginner to Visual C++. I am working on interfaces. I didn''t got one thing..
Suppose

//Problem Details

interface Shape 
{
    virtual void Draw();
};

interface Rectangle : Shape 
{
    virtual void Draw();
};

class Maths : Rectangle
{
public:  
    void Draw() {
        //Code for Draw
    }
};

//This was my problem
-----------------------------------------------------------
//We can just write the above whole code as...

class Maths
{
public:
    void Draw() {
        //Code for Draw
    }
};


-------------------------------------------------- -----------

我有自己的Draw()方法使用Math类.如果我们可以在第二种情况下编写上面提到的代码,那么需要什么接口.


-------------------------------------------------------------

I have class Maths with its own Draw() method. If we can write the above code as mentioned above in second case, then what the need of interfaces.

推荐答案




这篇关于Visual C ++接口问题-在最终在类本身中定义了所有方法之后,接口的需求是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 18:48