Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>One of the purposes you create classes for is to separate all unrelative data and operations to the different classes.</p> <p>In your case one part is calculations and the other part is result layout.</p> <p>So, the best way to implement it is to define a class which provides all calculations and access to results and implement the drawing function, which will use the object of your calculation class.</p> <p>Thus, it will be able to use your calculations in other environment (for example, in some your other project) without any code changing, which is natural. It will provide portability of your platform-independent caclulation code.</p> <p>And the layout part, which is platform-dependent, should be implemented separatly, using just interface, which is provided by the calculation class.</p> <pre><code> class Trajectory { public: // Constructor, computation call methods // "GetResult()" function, // which will return trajectory in the way you choose ... private: // computation functions }; // somewhere else void DrawTrajectory(Trajectory t) { // here is a place for calling all winapi functions // with data you get using t.GetResult() } </code></pre> <p>If abstract class is required you should inherit Trajectory class from an abstract class, where you will define all functions you have to call.</p> <p>In this case</p> <pre><code> // class ITrajectory { public: // virtual /type/ GetResult() = 0; // virtual /other methods/ }; class Trajectory : public ITrajectory { // the same as in previous definition }; void DrawTrajectory(ITrajectory T) { // the same as in previous definition } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload