Solved

Convert CPP to C#

Posted on 2014-04-19
2
385 Views
Last Modified: 2014-04-19
Hi..
Any idea how I can convert this to C#

struct extrema {
    int *mins, *maxes;
    extrema();
    ~extrema();
    void alloc(int size);
    void dealloc();
    void update(point prev, point cur);
} horizExtrema, vertExtrema;


I think it's something like  ?????

public class extrema
{

      public int mins;

      public int maxes;

      void update(point prev, point cur);
}
0
Comment
Question by:JElster
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 40010371
IMO that should be more like

public class extrema
{

      public int[] mins;

      public int[] maxes;

      public void alloc(int size)
      {
          mins = new int[size];
          maxes= new int[size];
      }
      // void dealloc(); <-- not needed in C#
      void update(point prev, point cur); // what is 'point' like?
} 

Open in new window

0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 40010459
Just to add to the last post. I imagine point would be System.Drawing.Point.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now