0

I got this piece of codes from https://developers.eos.io/eosio-cpp/docs/using-multi-index-tables

Here, something confused me, 1. what does this "using contract::contract" mean ? in cpp ,this means that you are using contract::contract scope in the following code, but if i want to define my own static constructor , i need to define it by myself right ? Must i use this in every eos contract ?

  1. for this code

    youvote( eosio::name receiver, eosio::name code, eosio::datastream ds ): eosio::contract(receiver, code, ds), _polls(receiver, code.value), _votes(receiver, code.value) {}

    It is a good practice in the latest eosio.cdt ?

    // this is the header file youvote.hpp
    #pragma once
    #include <eosiolib/eosio.hpp>
    
    //using namespace eosio; -- not using this so you can explicitly see which eosio functions are used.
    
    class [[eosio::contract]] youvote : public eosio::contract {
    
    public:
    
    //using contract::contract;
    
    youvote( eosio::name receiver, eosio::name code, eosio::datastream<const char*> ds ): eosio::contract(receiver, code, ds),  _polls(receiver, code.value), _votes(receiver, code.value)
    {}
    
    pollstable _polls;
    votes _votes;
    

    };

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.