#include <string>
#include <iostream>
using namespace std;
 
struct Point
{
    std::string name;
    double x, y, z;
    void move (double sx, double sy, double z)
    {
        x = x + sx;
        y += sy;
        this->z += z;
    }
};
 
void point_move (Point * self, double sx, double sy, double sz)
{
    self->x = self->x + sx;
    self->y += sy;
    self->z += sz;
}
 
int main ()
{
    Point * p = new Point;
    p->name = "start";
    p->x = 1.0;
    p->y = 2.0;
    p->z = 0.0;
    p->move (10, 20, 0);
 
    point_move (p, 10, 20, 0);
 
    cout << sizeof (p);
    cout << sizeof (*p);
 
    return 0;
}
 
uop/introduction.txt · Last modified: 2023/10/03 11:51 by 147.32.6.116
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki