typedef struct ...

Started by
10 comments, last by stefu 21 years, 9 months ago
why use classes and constructors and all that if you want c-portability? rather stupid. stick to c++..


      struct vec { float x,y,z; vec(){} vec(float _x,float _y,float _z):x(_x),y(_y),z(_z) {} vec operator + (const vec& _other) {  return vec(x+_other.x,y+_other.y,z+_other.z); }};      


note: i use _ for functionparameters, and m_ for member variables, except in this one, because i want to access x,y and z directly, and the m_ is just overhead in this case..

"take a look around" - limp bizkit
www.google.com

edit: i just edited a typo in the text, source remains the same

[edited by - davepermen on July 25, 2002 10:41:24 AM]
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud

Advertisement
quote:Original post by davepermen
why use classes and constructors and all that if you want c-portability? rather stupid. stick to c++..


This is a question that I''v been thinking of and just before I came here to read your answer I had decided to convert it fully to c++.

Thanks!

This topic is closed to new replies.

Advertisement