member-hiding Questions

11

Solved

What are differences between declaring a method in a base type "virtual" and then overriding it in a child type using the "override" keyword as opposed to simply using the "new" keyword when declar...
Banquet asked 1/10, 2008 at 22:6

1

Solved

By chance, I discovered that you can do this without the compiler complaining: extension Date { var timeIntervalSinceNow: TimeInterval { return 1000 } } What's weirder, is that this actually ...

9

Solved

Can anybody tell the working of overriding and hiding in terms of memory and references. class A { public virtual void Test1() { //Impl 1} public virtual void Test2() { //Impl 2} } class B : A {...
Elysia asked 15/6, 2012 at 7:30

1

Solved

Consider the following hierarchy of structs: struct I1 { virtual void doit() = 0; }; struct I2 { virtual void doit(int) = 0; }; struct I12 : I1, I2 { using I1::doit; using I2::doit; }; stru...
Hither asked 4/10, 2016 at 11:56

4

The version of a overridden method that gets invoked depends on if you care calling the function "through" the base class or "through" the derived class. However, I am finding if I call a non-over...
Aubervilliers asked 25/10, 2015 at 19:49

9

Solved

I have a problem with name hiding that is extremely hard to solve. Here is a simplified version that explains the problem: There is a class: org.A package org; public class A{ public class X{......
Strangury asked 4/7, 2014 at 10:25

2

Solved

Within a class, a field that has the same name as a field in the superclass hides the superclass's field. public class Test { public static void main(String[] args) { Father father = new Son()...
Rosanarosane asked 3/9, 2012 at 8:50

3

Solved

I was wondering what it means to say a field is hidden between 2 java classes and what it means when running code in terms of resulting output? I have an abstract class with a protected static boo...

3

Solved

Eclipse has a java compiler setting called "field declaration hides another field or variable" that can be set to warning/error. How important is this warning in your opinion? What is a good st...
Shem asked 8/11, 2010 at 10:19

4

Solved

I'm learning C# and I encountered the following problem. I have two classes: base and derived: class MyBase { public void MyMethod() { Console.WriteLine("MyBase::MyMethod()"); } } class MyDe...
Patricapatrice asked 23/3, 2010 at 12:36
1

© 2022 - 2024 — McMap. All rights reserved.