Jump to content
  • Advertisement
Sign in to follow this  
matthughson

Calling a Parent Function (C#) [solved]

This topic is 4664 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

Ok last C# question for a while, promise [wink] From what I understand, C# has done away with the scope ('::') operator, so how do you call a parents class version of an overriden method? Here is what I have
[source="C#"]
	// The base class for all world objects to derive from
	public class WorldObject
	{
		// Renders the object
		public virtual void render()
		{
			... // Some general render code
		}
	}



	public class WOLevelGenerator : WorldObject
	{
		// Renders the object
		public override void render()
		{
			... // Some WOLevelGenerator specific render code
			// In C++ I would put something like this here
			// WorldObject::render();
		}
	}



Does anyone know how to do something like that in C#; basically daisy change down an inheritance hierarchy? Thanks, Matt Hughson [Edited by - matthughson on October 8, 2005 11:37:27 PM]

Share this post


Link to post
Share on other sites
Advertisement
C# doesn't allow multiple inheritance (In my opinion it won't be missed [grin]); only a single base classe and an arbitrary number of interfaces can be used. (An interface is basically a collection of method that the class implementing the interface must implement.)

Here's some reading material

Share this post


Link to post
Share on other sites
Yeah now that you mention it, I remember reading that (just started this C# thing last night, so some things didn't really stick yet [wink]). They're kind of like a legitamized ADT.

Reading material... yuck! [wink]

Matt Hughson

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!