Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [inheritance]

The tag has no usage guidance.

0
votes
2answers
34 views

Invalid conversion from runtime type

I basically have the same problem that was described here Invalid conversion from runtime type MyClass.A to MyClass.B but i'm unclear as to what the solution is I have a virtual class A and classes B ...
9
votes
1answer
137 views

How can we expose inherited properties from a super component’s class in a lightning Web Components through targetConfigs (design attributes)

Is there currently a way of exposing properties inherited from super classes in Lightning Web Components, as design attributes (targetConfigs), or is this a gap? I’m inheriting base classes which ...
2
votes
2answers
32 views

Accessing Variables from a Parent Class

I am attempting to set up tests for my APEX classes, more specifically, I am attempting to create a parent class that includes a prepareDatabase function that creates data for my tests, and this ...
0
votes
1answer
31 views

how to call with inherited class in parent class

below is the code what i am trying is to fetch contact record in without sharing mode. commented part has the problem and it showing Method does not exist or incorrect signature: void ...
8
votes
1answer
115 views

Global lightning components and their inheritance of public components

Wondering if someone can clear this up for me; I have a global component in a managed package. I want to reuse this global component outside of the managed package. In a component outside of the ...
3
votes
2answers
349 views

DownCasting Failing In Custom APEX Classes

I am developing a custom APEX application called Subscribe. I have a parent wrapper class SubscribeObject: public virtual class SubscribeObject { public SObject record; public SObject ...
1
vote
2answers
63 views

Extending class variable does not exist on properties

I defined a virtual class and two classes that extend it with additional properties. After creating the class instance and trying to initialize it's properties i get a "Variable does not exist" error ...
1
vote
1answer
325 views

Call Parametrized constructor using Type.newInstance()?

I am designing a solution where it should be flexible to add handlers using configuration. So I am saving the handler class name in the custom metadata record and then would be instantiating it using ...
2
votes
2answers
145 views

(Why?) Is it good for Apex classes and methods to be final? [closed]

By default, in Apex, unlike Java and other OOP languages, all classes and methods are final. You aren't allowed to make this explicit and if you want things not to be final, you need to use the ...
16
votes
1answer
298 views

Are Apex interfaces and abstract classes case-sensitive?

My understanding from the docs is that apex class and method names are case-insensitive. I've run across an edge-case with interfaces and abstract classes which appears to be undocumented behavior ...
0
votes
1answer
57 views

Method does not exist or incorrect signature: void show() from the type Child2

Line: 2, Column: 3 Method does not exist or incorrect signature: void show() from the type Child2. Above is the error im getting. How can I rectify it? public Virtual class Parent2 { public string ...
2
votes
1answer
49 views

Dynamically get object type (something like this.class)

I've got a base class BaseClass and a bunch of derived classes MyClass1, MyClass2. Now, I want to be able to get Type of derived class at the level of BaseClass. I found online some workaround for how ...
6
votes
0answers
63 views

Can an extending component find by aura:id in its base component? [duplicate]

I have a base (abstract) component: <aura:component abstract="true" extensible="true"> <aura:attribute name="instanceId" type="Object"/> <aura:handler name="init" value="{! ...
2
votes
1answer
299 views

Lightning Component Polymorphism is not working:

I am trying to use Bob Buzzard approach to get Lightning Component Polymorphism working, so I have method myAction: function(component) { component.getConcreteComponent().getDef().getHelper()....
2
votes
0answers
57 views

Virtual Class Properties Not Returned from Apex to Lightning Component

I'm seeing that public fields from an Apex base virtual class are not returned to a lightning controller. The Apex controller: public with sharing class MyApexController { public virtual class ...
4
votes
1answer
204 views

Apex double override

I have the following classes: public virtual class BaseWorker { public virtual myMethod(){ } } public virtual class SonWorker extends BaseWorker{ public virtual override myMethod(){ }...
4
votes
1answer
49 views

Why does this() in an if statement not throw compiler error

Using 'this();' inside an if statement in a constructor does not throw a compiler error. It should throw 'Call to 'this()' must be the first statement in a constructor'; If it is allowed then it ...
3
votes
2answers
642 views

Lightning rerendering, inheritance, and forceCommunity:navigationMenuBase

I've been working on a heavily customised Lightning Community where a lot of the UI effects are achieved using Javascript supplied by a design agency. These are included in the Lightning Community by ...
11
votes
1answer
1k views

Are Lightning Interfaces (e.g. implements=“c:MyInterface”) actually useful for anything?

I've been trying to build a Lightning Community where I use component inheritance and interfaces to share certain bits of functionality. For my particular use, composition wouldn't fit as well as ...
6
votes
2answers
541 views

In Apex, is it possible to use Polymorphism and Overloading to mitigate the need for conditional logic?

While working-on/playing with the Build a Restaurant-Locator Lightning Component Trailhead, I wanted to develop a more clever (possibly read over-engineered) way of selecting address from either the ...
1
vote
1answer
130 views

A class in one namespace dynamically instantiating an object outside its namespace

I have a managed package with namespace myNamepace and a class ClassA which resides in that package will be dynamically instantiating objects of all subclasses of a particular abstract class ...
3
votes
2answers
646 views

Disable Overriding in Apex

As a follow up to this question I posted yesterday, I have a generic batch job class as so: public abstract class GenericJob implements Database.Batchable<SObject>, Database.Stateful { ...
1
vote
3answers
140 views

Apex Inheritance: illegal Assignment

Why is the following code returning an illegal assignment error in anonymous window? Line: 3, Column: 9 illegal assignment from truck to vehicle Super Class public virtual class vehicle { ...
3
votes
1answer
471 views

Unable to access Superclass's public member variable from Subclass

I am trying assign value into the Super class member variable which is declared as public, but unable to access that SuperClass variable from Subclass. It is throwing compiler error, Variable does ...
5
votes
1answer
766 views

Custom Metadata Types versus Custom Objects for product/system types?

I have a use case where I plan to use Custom Metadata Types. I would create multiple custom metadata types, each one looking up to its master. First the base product, then product/family, where one ...
7
votes
2answers
102 views

simple expression evaluation for extended lightning component is sometimes wrong

In this simple and straightforward scenario the evaluation of an expression is not getting updated correctly. I have two components, an (abstract) base component and an extended one: cmBaseComponent:...
25
votes
2answers
247 views

Unintended polymorphic private method

I've run into an odd case where a base class is calling a private method in a subclass that isn't defined as an override. It's a bit contrived, but demonstrates the issue: public virtual with ...
26
votes
4answers
3k views

Lightning LockerService and Component Inheritance

(I'm hoping one of the Lightning Component developers will be able to chime in on this, as I'm rather concerned that the LockerService will break code using inheritance) Salesforce are introducing ...
16
votes
1answer
1k views

Abstract, Interface, Classes OH MY - Question on Approach

So I believe that I have a real world use case for an object model that uses abstract classes and interface. I do however have a few questions about the best way to go about it: Interface public ...
0
votes
1answer
156 views

extend a class that implement Messaging.InboundEmailHandler (email service)

I use to develop in java where i can extend a class that implement an interface. This way, the child-class implement the interface too and extends the overrided methods. I am trying to do the same ...
5
votes
1answer
1k views

How to extend a standard lightning ui component?

I had the following idea: why not take ui:inputTextArea and extend it to show a little counter that tells you how many characters youve entered. So i extended ui:inputtextarea, added another ...
0
votes
1answer
149 views

Managed type that is released without a supertype can not subsequently extend another type

I'm currently getting this error trying to push updated code into my packaging org for our managed package: Managed type that is released without a supertype can not subsequently extend another type ...
5
votes
1answer
137 views

Attribute Inheritance

I'm trying to use simple inheritance to populate a varable depending on the status code of an API response but I'm having a weird error while saving the class. The error message: Variable does not ...
1
vote
1answer
400 views

Object design - inheritance?

We want to receive orders via API from web to Salesforce. We also want order to be related to lead - so the rep can quickly see that right after he clicks on the lead. The problem is, that there are ...
3
votes
1answer
118 views

Implementing multiple view models

I have the following scenario where I'm trying to use view models which will be accessed in the Visualforce page from various controller, in order to build the various UIs. interface IOne { void ...
3
votes
3answers
1k views

Make a lightning component attribute available to children

I have a component that's really just a container. I'd like to be able to set an attribute on the container and have that attribute be able to passthrough anything I put inside the container without ...
6
votes
1answer
1k views

How do I override an inherited static remote method in APEX or VisualForce?

I have a parent class that provides a set of remote action methods that are common to my other controllers: global virtual with sharing class MyBaseClass { @RemoteAction global static void ...
4
votes
1answer
73 views

Debug logs in abstract parent class not showing

I have some inheritance going in in classes and I need to know what is going on in the parent code. For some reason, I can get debugs from the child class but not the parent. Child class: public ...
4
votes
1answer
176 views

Could private method be overriden in the inheritance hierarchy?

I've encountered with a bit strange issue which breaks my understanding of basic OOP principles. In short, there are two classes: parent (virutal) and child (extends parent). Both of them have ...
3
votes
2answers
241 views

Member variable null after being set from subclass

Before I start, I realize a possible solution here is to have InnerClass explicitly reference the testString variable in the Inherited class like such: In the constructor: OuterClass o = oc; In ...
3
votes
2answers
2k views

why regular class cannot be extended?

I am a extending class with out using abstract or virtual class ,it throwing me the error "non-virtual or non-abstract classes cannot be extended". why regular classes cannot be extended in apex. ...
1
vote
1answer
289 views

How to support inheritance with WSDL2Apex

I'm attempting to update the tooling api project (https://github.com/afawcett/apex-toolingapi) with a SOAP variant in addition to the REST api. The issue I'm currently having is supporting all the ...
16
votes
1answer
2k views

Static Inheritance and SUPER keyword

Question about how static member/method inheritance works in apex: For reference, this question is related, but doesn't address my question or take into account my findings: reference question I ...
3
votes
2answers
3k views

Can I override a private abstract method from abstract class?

I have an abstract class which has abstract methods. All methods are public. I don't need them to be public, so I tried to remove public or put private. But it keeps saying Compilation error: ...
6
votes
1answer
4k views

Controller Class Inheritance vs Multiple Controller Extensions

From reading the docs and dev forums, it seems that having multiple controller extensions can offer the ability to override methods, and keep class size/structure simple. Because these are things ...