Archived

This topic is now archived and is closed to further replies.

Instances?

This topic is 4946 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey all, noob question on instances. Ive read in various places an instance is an occurance...can anybody please elaborate? Thanks (IRL Examples help me best thx again )

Share this post


Link to post
Share on other sites
An int is a datatype.

int iInteger;

iInteger is an instance of an int.

class CPlayer
{
// Stuff
};

CPlayer PlayerOne;

PlayerOne is an instance of CPlayer object.

Clear?

Share this post


Link to post
Share on other sites
well im not sure if im correct but if you had a class such as:


class circle
{
private:
int Centre_x;
int Centre_y;
int Radius;

public:
int Get_Radius();
int Get_Centre_X();
int Get_Centre_Y();
POINT Get_Centre();
};


if that was your class then you would make an instance of that class by doing:


#include <whatever.h>

circle Circular_Object;


well the object "Circular_Object" would be an Instance of class circle... if that makes any sense... i may not be right as i just code stuff i dont really think of the technical names of it all.. but thats what i would think an instance would be....

Share this post


Link to post
Share on other sites