我在一个类中有一个矩阵,我想在另一个类的方法中使用它可以帮助我 [英] I have a matrix in a class and I want to use it in a method in another class can you help me

查看:52
本文介绍了我在一个类中有一个矩阵,我想在另一个类的方法中使用它可以帮助我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类中的矩阵,我想使用它的方法在另一类,你可以帮我

解决方案
下面是薄的一个简单的例子您已声明的要求:



 Class Matrix 
{
public Matrix( int n, int m)
{
// code ...
}

公共矩阵交叉积(矩阵M)
{
<跨度类= 代码注释> // <跨度类=代码-comment>计算的该叉积和矩阵M
<跨度类=代码注释> // <跨度类=代码注释>返回交叉产品
}
}


// 这个类正在使用Matrix类
类UsingTheClassMatrixExample
{

<跨度类= 代码关键字>公共 <跨度类= 代码关键字>静态 DoStuff()
{
矩阵M1 = 矩阵....
矩阵M2 = 矩阵....

Matrix CrossProduct = M1.CrossProduct(M2);
}
}



如果您需要进一步的帮助,比如如何在其他项目中使用Matrix类作为dll让我知道。



祝你好运,

Edo


I have a matrix in a class and I want to use it in a method in another class can you help me

解决方案

Here's a simple example for the thin requirement you've stated:

Class Matrix
{
   public Matrix (int n, int m)
   {
      // code ...
   }

   public Matrix CrossProduct(Matrix M)
   {
       // Calculate the Cross Product of this and the Matrix M
       // return the Cross Product
   }
}


// this class is using the Matrix class
Class UsingTheClassMatrixExample
{

   public static DoStuff()
   {
       Matrix M1 = new Matrix....
       Matrix M2 = new Matrix....

       Matrix CrossProduct = M1.CrossProduct(M2);
   }
}


If you need further help, like how to use the Matrix class as a dll in a different project etc let me know.

Good luck,
Edo


这篇关于我在一个类中有一个矩阵,我想在另一个类的方法中使用它可以帮助我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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