16. Class va Object

a) C# dasturlash tilida objectni qanday yaratasiz?

class ClassName //sinf yaratish
{
// Fields (ma’lumotlar)
// Methods (xatti-harakatlar)
}

b) Quyidagi kodda qanday xato bor?

class Person
{
public string Name;

public int Age;…


This content originally appeared on DEV Community and was authored by Sunnat Qayumov

a) C# dasturlash tilida objectni qanday yaratasiz?

class ClassName //sinf yaratish
{
    // Fields (ma'lumotlar)
    // Methods (xatti-harakatlar)
}

b) Quyidagi kodda qanday xato bor?

class Person
{
    public string Name;

    public int Age;
}
Person p;
p.Name = "John";

Xato: Person p deb yaratib bo'lmaydi. To'g'ri kod: Person p = new Person();


This content originally appeared on DEV Community and was authored by Sunnat Qayumov


Print Share Comment Cite Upload Translate Updates
APA

Sunnat Qayumov | Sciencx (2024-10-13T01:24:25+00:00) 16. Class va Object. Retrieved from https://www.scien.cx/2024/10/13/16-class-va-object/

MLA
" » 16. Class va Object." Sunnat Qayumov | Sciencx - Sunday October 13, 2024, https://www.scien.cx/2024/10/13/16-class-va-object/
HARVARD
Sunnat Qayumov | Sciencx Sunday October 13, 2024 » 16. Class va Object., viewed ,<https://www.scien.cx/2024/10/13/16-class-va-object/>
VANCOUVER
Sunnat Qayumov | Sciencx - » 16. Class va Object. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/10/13/16-class-va-object/
CHICAGO
" » 16. Class va Object." Sunnat Qayumov | Sciencx - Accessed . https://www.scien.cx/2024/10/13/16-class-va-object/
IEEE
" » 16. Class va Object." Sunnat Qayumov | Sciencx [Online]. Available: https://www.scien.cx/2024/10/13/16-class-va-object/. [Accessed: ]
rf:citation
» 16. Class va Object | Sunnat Qayumov | Sciencx | https://www.scien.cx/2024/10/13/16-class-va-object/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.