C# How to derives A from B, where B in different .cs file

I have question about inheritance of c# in Unity 3D.

Let’s say,
below is my first file, parent.cs :

using System;

public abstract class parent {
    private string _name;

    public parent() {
        _name = "my name is ";
    }
	
	public void appendName(string _appendThis) {
		_name += _appendThis;
	}
	
	public string getName() {
		return _name;
	}
}

Then, below is my second file, child.cs :

using UnityEngine;
using System;

public class child : parent {
    public child() {
        base.appendName("gsunity");
    }

    public string SayName() {
        return base.getName();
    }
}

Then I have last file, myunity.cs :

using UnityEngine;
using System;

public class myunity : MonoBehaviour {
    private child guy = new child();

    void Start() {
        Debug.Log(guy.SayName());
    }
}

My Question is, how to using another cs file in Unity 3D, like three c# script above as the example?


Edited in July 21, 2011.

There was a lot of wrong statement in my script before.
So I alter all above script after I finish downloading Unity and tried it.

The parent class must declared like this:
public abstract class parent
I was forgot to write public keyword before the abstract keyword.

Now my script can work as it should.
I just had to Drag and Drop the myunity.cs to an object that I created before.
And the other script (parent.cs and child.cs) was run automatically.

My problem now has been solved.
Thank’s all

Well for starters you can’t instance an abstract class, but I assume that’s just a typo so I’ll move onto the actual question.

Your scripts should work fine. The only thing I could see that could cause issues it the compilation order. You want to make sure that the parent and child classes are compiled on the same level, and the myunity class is compiled on the same level or after.