From -8655529086275849505
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,2b0387157d35b1a9,start
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1995-01-12 22:09:59 PST
Newsgroups: comp.std.c++
Path: nntp.gmd.de!Germany.EU.net!howland.reston.ans.net!agate!library.ucla.edu!zephyr!typhoon!busfield
From: busfield@typhoon.seas.ucla.edu (John D. Busfield)
Subject: Need advice on developing classes
Sender: news@seas.ucla.edu (News Daemon)
Message-ID: <D2ByGp.E4A@seas.ucla.edu>
Date: Fri, 13 Jan 1995 06:09:59 GMT
Organization: School of Engineering & Applied Science, UCLA.
X-Newsreader: TIN [version 1.2 PL2]
Lines: 52

I'm currently making the transition from C to C++ and I understand the
basics of classes but need help with some specifics.
Here's what I'm trying to do:
 I have a Matrix Class and a Vector Class

class Vector
{
	private:
		long pt[3];
	public:
		ReadVector();
		etc..
}

class Matrix
{
	private:
		long m[12];
	public:
		Matrix();	//default constructor
		Matrix(Vector rot,Vector trn);
		etc..
}

Matrix::Matrix(Vector rot,Vector trn)
{
	long cY = cAngles[rot[0]];
	long sY = sAngles[rot[0]];
 etc..
}

Obviously the problem is that the Matrix class tries to access the Vector
classes private members and this is illegal. 

What I would like to know is what is the best way to make things like
this work. I know I could use friend functions but I am not to crazy
about friend functions because they seem to be a way to sidestep OOP
principles. I also don't like the idea of writing a function that
within the method class that simply returns an element of that class
because I'll be using these functions for 3d graphics where speed is
critical and this extra step seems to be inefficient. Should I just
make the Vector class a struct instead or is there a good way to do
this with classes.

Thanks John.


--
----------------------------------------------------------------------------
John Busfield	
Reality Bytes Inc.		
busfield@hurricane.ucla.edu


