Class inheritance issue during deserialization in C# API

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

pratts
Posts: 34
Joined: 23 Aug 2016, 17:46

Class inheritance issue during deserialization in C# API

Postby pratts » 21 Dec 2017, 11:55

Hi,

I am facing issue when deserialize base class on C# client using SFS API.
I have two classes, one is Class A (Base Class) and Class B (Child Class) , code are as below :-

Code: Select all


public class A implements SerializableSFSType{
   public int a =0;
   public A(){}
   public int getA() {
      return a;
   }
   
   public void setA(int a) {
      this.a = a;
   }
}

public class B extends A implements SerializableSFSType{
   public int d =0;
   public B(){}
   public int getD() {
      return d;
   }
   
   public void setD(int d) {
      this.d = d;
   }
}



Created below classes for C# client

Code: Select all

public class A : SerializableSFSType{
   public int a =0;
   public A(){}
   public int getA() {
      return a;
   }
   
   public void setA(int a) {
      this.a = a;
   }
}

public class B : A , SerializableSFSType{
   public int d =0;
   public B(){}
   public int getD() {
      return d;
   }
   
   public void setD(int d) {
      this.d = d;
   }
}


Using below code at client side to get object from sfs object.
this.objA = (A)sfsdata.GetClass("SFSKEY");

objA.d -> has value sent by server
objA.a -> do not contain any value.

Help me how I will get values for base class variables also.
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Class inheritance issue during deserialization in C# API

Postby Lapo » 22 Dec 2017, 07:24

Hi,
the problem is that inheritance is not supported.
viewtopic.php?f=20&t=16451&p=70715&hilit=inheritance#p70715

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 79 guests