Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: c++ user defined types question  (Read 2875 times)

0 Members and 1 Guest are viewing this topic.

devil0150

    Topic Starter


    Beginner

    Thanked: 1
    c++ user defined types question
    « on: November 28, 2010, 08:24:35 AM »
    I made a vector2D class with a "double magnitude;" data member. I also have some functions that take double as arguments. Is there any way I can put a vector2D object as an argument to these functions instead of "vector2D.magnitude"? If so, does it work only if magnitude is public or does it also work as private?

    BC_Programmer


      Mastermind
    • Typing is no substitute for thinking.
    • Thanked: 1140
      • Yes
      • Yes
      • BC-Programming.com
    • Certifications: List
    • Computer: Specs
    • Experience: Beginner
    • OS: Windows 11
    Re: c++ user defined types question
    « Reply #1 on: November 28, 2010, 09:16:48 AM »
    make the structure public in the same namespace as the class but not in the same class. I believe you can simply place the definition immediately before the class definition.
    I was trying to dereference Null Pointers before it was cool.