1 year ago

It's been 6 months since the last poll. Again. That's what I call stability.

What will be output to the console when the Start() method is executed?

Choose the answer below!

(Full code in the article)


SampleScript.cs

		
			using UnityEngine;

namespace Assets.Samples.Sample3
{
    public class SampleScript : MonoBehaviour
    {
        private void Start()
        {
            Base overrideExample = new OverrideExample();
            Base hidingExample = new HidingExample();

            print(quot;{overrideExample.Name} {hidingExample.Name}");
        }
    }
}
		
	

Base.cs

		
			namespace Assets.Samples.Sample3
{
    public abstract class Base
    {
        public virtual string Name => nameof(Base);
    }
}
		
	

OverrideExample.cs

		
			namespace Assets.Samples.Sample3
{
    public class OverrideExample : Base
    {
        public override string Name => nameof(OverrideExample);
    }
}
		
	

HidingExample.cs

		
			namespace Assets.Samples.Sample3
{
    public class HidingExample : Base
    {
        public new string Name => nameof(HidingExample);
    }
}
		
	
  37 votes Voting finished



2 comments

Loading...

Next up

Well, it's time to introduce you to the game I've been working on for the past 3 months.

This is a puzzle mobile game with very simple gameplay. It's free, so give it a try!

https://gamejolt.com/games/connect-it/813494

Gameplay screenshot

(The game is still alive)

This long way has come to an end.

Check out the article

Our 2024 Advent Calendar has opened! Day 28: @Silentfaith is a great Creator and comic artist who also codes fan games! Accept the quest and give them a follow to get Coins and a seasonal sticker!

Unity has changed its policy regarding Runtime Fee: https://unity.com/pricing-updates. Major changes in the article.

Happy #WIPWednesday!

Are you working on a game?

Making some art?

Practicing a song?

Something else?

Tell us in the comments!

Help wanted!

3D environment artist, 2D artist

Check out the article

Help wanted!

Voice actors, translators

More info in the article

Our 2024 Advent Calendar has opened! Day 29: @Dungeonation is a great Creator who draws cartoons and dabbles in making games! Accept the quest and give them a follow to get Coins and a seasonal sticker!

Help wanted!

3D environment artist, 2D artist

More info in the article