abstract-class

how to achieve table per concrete class when base class is abstract in fluent nhibernate?

这一生的挚爱 提交于 2020-01-01 02:38:26
问题 i have the following scenario public abstract class BaseClass { public virtual int Id {get; set}; public virtual string Name {get; set;} } public class FirstSubClass : BaseClass { //properties and behaviour here } public class SecondSubClass : BaseClass { //properties of SecondSubclass Here } public class ProcessStep { public virtual IList<BaseClass> ContentElements {get; set;} } for mapping i have used following code snippet :- this._sessionFactory = Fluently.Configure().Database

Using WCF with abstract classes

余生长醉 提交于 2019-12-31 09:21:29
问题 How do I define DataContract for abstract classes in WCF? I have a class "Person" which I communicate successfully using WCF. Now I add a new class "Foo" referenced from Person. All still good. But when I make Foo abstract and define a sub class instead it fails. It fails on the server side with a CommunicationException, but that doesn't really tell me much. My simplified classes made for testing: [DataContract] public class Person { public Person() { SomeFoo = new Bar { Id = 7, BaseText =

Using WCF with abstract classes

元气小坏坏 提交于 2019-12-31 09:21:13
问题 How do I define DataContract for abstract classes in WCF? I have a class "Person" which I communicate successfully using WCF. Now I add a new class "Foo" referenced from Person. All still good. But when I make Foo abstract and define a sub class instead it fails. It fails on the server side with a CommunicationException, but that doesn't really tell me much. My simplified classes made for testing: [DataContract] public class Person { public Person() { SomeFoo = new Bar { Id = 7, BaseText =

Web services - XmlInclude in a derived class instead of a base class?

落花浮王杯 提交于 2019-12-31 04:41:27
问题 I am using an abstract class as a parameter in a web service call. Currently, I am including an XmlInclude of a derived class in the base class, like so: [XmlInclude(typeof(DerivedClass))] public abstract class BaseClass { } However, I'd rather not include all of the derived types in the base class. In http://www.pluralsight.com/community/blogs/craig/archive/2004/07/08/1580.aspx, the author mentions an alternative - writing the attribute above the web method instead, like so: [WebMethod]

Abstract classes and Multiple Inheritance

吃可爱长大的小学妹 提交于 2019-12-31 03:31:10
问题 We can achieve the same functionality as interfaces by using abstract classes, So why java doesn't allow the following code? abstract class Animals { public abstract void run(); } abstract class Animals1 { public abstract void run1(); } class Dog extends Animals,Animals1 { public void run() {System.out.println("Run method");} public void run1() {System.out.println("Run1 method");} } I know that multiple inheritance can be achieved by using only interfaces but the above code does the same

Reference outside the sealed class in Kotlin?

不问归期 提交于 2019-12-31 02:45:15
问题 I'm trying to create a class that uses its own state to operate on the state of an external object that it holds a reference to. The external object can be of class A or B, which are similar, but not controlled by the author. So a sealed class is created to access their common attributes, per this earlier answer from @SimY4. // *** DOES NOT COMPILE *** class A { // foreign class whose structure is not modifiable val prop get()= "some string made the Class-A way" } class B { // foreign class

How to call abstract class method in java

[亡魂溺海] 提交于 2019-12-30 08:33:30
问题 I want to call a method of an abstract class in my own class. The abstract class is: public abstract class Call { public Connection getEarliestConnection() { Connection earliest = null; ... return earliest; } } I want to call the above method, and the calling class is: public class MyActivity extends Activity { Connection c = new Connection(); private void getCallFailedString(Call cal) { c = cal.getEarliestConnection(); if (c == null) { System.out.println("** no connection**"); } else {

Can an abstract class be member of other concrete class as composition relationship ? c++

谁说我不能喝 提交于 2019-12-30 06:58:33
问题 P is an abstract class, I want to make it member of class A which is a normal concrete class. Is it possible if yes how. Relationship is composition Thanks for help 回答1: Since P is abstract, you can never create an object of that type. However, you can store a pointer to P as a member of class A ; this pointer member could then point to an instance of a (concrete) subclass of P . 回答2: No. A composition relationship implies that class Client actually contains a member variable of type

How to use moq to test a concrete method in an abstract class?

僤鯓⒐⒋嵵緔 提交于 2019-12-30 03:01:27
问题 In the past when I wanted to mock an abstract class I'd simply create a mocked class in code that extended the abstract class, then used that class in my unit testing... public abstract class MyConverter : IValueConverter { public abstract Object Convert(...) { ... }; public virtual Object ConvertBack(...) { ... } } private sealed class MockedConverter : MyConverter { ... } [TestMethod] public void TestMethod1() { var mock = new MockedConverter(); var expected = ...; var actual = mock

VBA: is there something like Abstract Class?

限于喜欢 提交于 2019-12-30 01:06:48
问题 I'm using an interface to ensure some similar classes implements some mandatory methods (subs/functions). Example: interface I1 declares M1 and M2 methods C1 and C2 implement I1, and have their own versions for M1 and M2. C1 and C2 also need methods that are exactly the same, for example methods SM1 and SM2. To avoid repeating SM1 and SM2 I'd like to define an abstract class AC: implementing I1 defining SM1 and SM2. which would be extended by C1 and C2 This solution is indeed possible in Java