What you are inquiring about is called inheritance.

When you have contract B inherit from contract A (contract B is A) you are telling B to have not only it's own variables and functions defined, but also those in contract A.

If you deploy contract B (which inherits from contract A) you are NOT deploying 2 contracts you are deploying just 1 contract which has it's variables and functions "merged" with the contracts it inherits from.

An instance of contract B will have both B's and A's variables. Remember, it is only 1 contract that exists. If you also deployed a contract A they would be separate instances that are not related at all between each other (other than sharing a similar structure).

When dealing with functions, if you implement on B a function with the same signature (same name, paramters, return types) as one of A's, then function B implementation overrides A's. So, calling someFunc() on this instace will do whatever B defined and not A, if they have the same signature.

When instantiating B, it's constructor will be called. If you also want to have A's constructor called, you have to do it explicitly.

In your example above:

B's constructor should look like:

function B(uint _randomVariable2, uint _randomVariableA) A(_randomVariableA){ owner = msg.sender; randomVariable2 = _randomVariable2; }

This will cause A's constructor to be called, passing the parameter/s you specify.