0% found this document useful (0 votes)
2 views2 pages

Oops Student Example

OOPS programming

Uploaded by

Mohammad basha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Oops Student Example

OOPS programming

Uploaded by

Mohammad basha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IngestDataToLA
{
//class declaration
internal class Student
{
public string name;
public byte age;
public int rollnumber;
public string address;
public ulong phonenumber;
public string classStudying;
}
//internal - > Access modifier
//class - > keyword which is used to declare classes
//Student -> Class name

internal class TestClass


{
//syntax of object creation
// <ClassName> <variableName> = new <classname>();
// "." (Dot) is a Operator, which is used to call the states and
behaviours
// of a class
static void Main()
{
Student objStudent = new Student();
objStudent.name = "Rasool Bee";
objStudent.age = 22;
objStudent.address = "Ameerpet, Hyderabd";
objStudent.phonenumber = 123456789;
objStudent.rollnumber = 313;
objStudent.classStudying = "BSC Computers";

Console.WriteLine("Student Name: "+ objStudent.name);


Console.WriteLine("Student Age: "+ objStudent.age);
Console.WriteLine("Student Phone Number: "+ objStudent.phonenumber);
Console.WriteLine("Student Address:"+ objStudent.address);
Console.WriteLine("Student Roll Number: "+ objStudent.rollnumber);
Console.WriteLine("Class Studying: "+ objStudent.classStudying);

Console.WriteLine();
Console.WriteLine();

Student objStudent2 = new Student();


objStudent2.name = "Mohammad";
objStudent2.age = 26;
objStudent2.address = "Sr Nagar, Hyderabd";
objStudent2.phonenumber = 876876755;
objStudent2.rollnumber = 54;
objStudent2.classStudying = "Mechanical Enineering";

Console.WriteLine("Student Name: " + objStudent2.name);


Console.WriteLine("Student Age: " + objStudent2.age);
Console.WriteLine("Student Phone Number: " + objStudent2.phonenumber);
Console.WriteLine("Student Address:" + objStudent2.address);
Console.WriteLine("Student Roll Number: " + objStudent2.rollnumber);
Console.WriteLine("Class Studying: " + objStudent2.classStudying);

Console.ReadLine();
}
}
}

//Namespace block should contain only classes

// Classes should contain only states/fields/variables and


behaviours/methods/functions

You might also like