Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    استفاده از متغییر در سراسر برنامه کیوت

    Persian
    4
    4
    1502
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sahand last edited by

      با سلام خدمت دوستان من قبلا از سی شارپ برای برنامه نویسی استفاده می کردم و براحتی می تونستم با تعریف یک متغییر عمومی از اون در سراسر برنامه استفاده کنم اما در حال حاضر من با استفاده از سی پلاس در محیط کیوت نمی تونم از یک متغییر در سراسر برنامه(همه کلاس ها استفاده کنم)

      لطفا اگر کسی تجربه داره راهنمایی بفرمایید

      1 Reply Last reply Reply Quote 0
      • M
        mojtaba_shateri last edited by

        shoma age ye variable global dar yek file cpp tarif koni, mituni ba extern kardane un dar filhaye dige azash estefade koni. tavajjoh dashte bash k nabayad variable static bashad, dar surate static budan faqat dar haman file ghabele estefade ast.
        mesal:
        dar main.cpp yek variable global be shekle zir tarif mikonim.

        int myVar;
        int main (){
        return 0;
        }
        hala dar filaye dige (cpp) mitunim ba extern kardane un be shekle zir , azash estefade konim.

        extern int myVar;

        ba in hesab age dar file main.cpp meghdare myVar avaz shavad , ma be meghdare an dar filhaee ke externe moteghayyero tarif kardan dastresi darim.

        Mojtaba Shateri
        [dot]Programmer

        1 Reply Last reply Reply Quote 0
        • S
          shoniz last edited by

          من هم همچین مشکلی دارم اما نه از نوع int.
          من میخوام یه فایل بصورت QString در یک فایل CPP ایجاد کنم و در جای دیگر ازش استفاده کنم.

          1 Reply Last reply Reply Quote 0
          • I
            imamirali Banned last edited by

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • First post
              Last post