dimanche 26 juin 2016

What is the C/C++ equivalence of java.io.Serializable?

What is the C/C++ equivalence of java.io.Serializable?

There're references to serialization libraries on:

And there are:

But do such an equivalence even exists?

So if I have an abstract class as follows in Java, how would a serializable class in C/C++ look like?

import java.io.Serializable;

public interface SuperMan extends Serializable{

    /**
     * Count the number of abilities.
     * @return
     */
    public int countAbility();

    /**
     * Get the ability with index k.
     * @param k
     * @return
     */
    public long getAbility(int k);

    /**
     * Get the array of ability from his hand.
     * @param k
     * @return
     */
    public int[] getAbilityFromHand(int k);

    /**
     * Get the finger of the hand.
     * @param k
     * @return
     */
    public int[][] getAbilityFromFinger(int k);

    //check whether the finger with index k is removed.
    public boolean hasFingerRemoved(int k);

    /**
     * Remove the finger with index k.
     * @param k
     */
    public void removeFinger(int k);

}

Could any serializable C/C++ object just be inherited like in Java?

Aucun commentaire:

Enregistrer un commentaire