How can you tell what shell you are running on UNIX system?

Q

You can do the Echo $RANDOM. It will return a undefined variable if you are from the C-Shell, just a return prompt if you are from the Bourne shell, and a 5 digit random numbers if you are from the Korn shell. You could also do a ps -l and look for the shell with the highest PID.

✍: Guest

A

class Point2D{
int x; int y;

public int color;
protected bool pinned;
public Point2D() : x(0) , y(0) {} //default (no argument) constructor
};

Point2D MyPoint;

You cannot directly access private data members when they are declared (implicitly) private:

MyPoint.x = 5; // Compiler will issue a compile ERROR
//Nor yoy can see them:
int x_dim = MyPoint.x; // Compiler will issue a compile ERROR

On the other hand, you can assign and read the public data members:

MyPoint.color = 255; // no problem
int col = MyPoint.color; // no problem

With protected data members you can read them but not write them: MyPoint.pinned = true; // Compiler will issue a compile ERROR

bool isPinned = MyPoint.pinned; // no problem

2012-02-11, 2730👍, 0💬