RE: C++-Buch fur Anfanger bis Fortgeschrittene

Philip M. Galea pgalea at btinternet.com
Sun Nov 7 20:33:31 GMT 1999


If its a pointer to an object use '->'.  if its an instance of the object 
use '.'

For example:

class Abc
{
	public:
		int foo()	;
};


Abc abc_object;			// This is an instance of the Abc class
Abc *abc_ptr = abc_object;	// This is a pointer (initialised to point to 
abc_object)


If you want to call the foo function via the abc_object then used use the 
'.' ie

	abc_object.foo();

>From the point use -> i.e.

	abc_ptr->foo();

The -> simple defers to the memory location being pointed to by the pointer 
which in the above example would be abc_object's memory location.

Now before you ask,

public means the methods, properties can be access
private means the methods, properties cannot be access out with the class 
or friend classes
protected is usually used when creating abstract classes. Anyway is like 
private except children who inherit from the base class have access 
everything else doesn't (again friend classes can)


Philip M. Galea
http://www.cee.hw.ac.uk/~ceepmg/

PS I'm still having trouble with lex files

-----Original Message-----
From:	Roland Schafer [SMTP:RolandSchaefer at gmx.net]
Sent:	06 November 1999 22:49
To:	kdevelop at barney.cs.uni-potsdam.de
Subject:	Re: C++-Buch fur Anfanger bis Fortgeschrittene

I finally finished my first KDE app. A Viewer for the stdinput.
Works very well.
Done with widgets, slots, signals, objects and so on and i think,
i understood, what i wrote. But most problems i solved with
trying ("->" doesn't work, let's try "."). So i need some kind of
explanation of the c++ object-model.

Roland





More information about the KDevelop mailing list