Category: PPL Practicals

Static polymorphism in C#

PRINCIPLES OF PROGRAMMING LANGUAGES PRACT. Implement static/runtime polymorphism in C#. using System; namespace ATC {     public class ATC     {         void Show(int a)         {             Console.WriteLine(“int a = {0}”,a);         }         void […]

Implement Encapsulation in C#

PRINCIPLES OF PROGRAMMING LANGUAGES PRACT. Implement Encapsulation in C#. using System; namespace ATC {     class AreaDimension     {       public double length;       private double width;              public double GetWidth() {          Console.WriteLine(“Enter Width here becuase its private: “);     […]

program in Java to implement concurrent execution of a job using threads.

PRINCIPLES OF PROGRAMMING LANGUAGES PRACT. Write a program in Java to implement concurrent execution of a job using threads. class Multithreading extends Thread  {  public void run()  {  try {  System.out.println (“Thread ” +  Thread.currentThread().getId() +  ” is running”);  }  catch (Exception e)  {  System.out.println (“Exception is caught”);  }  }  }    public class Multithread  {  […]

Call by reference in C++

PRINCIPLES OF PROGRAMMING LANGUAGES PRACT. Write a program in C++ to implement call by reference parameter passing Method. #include <iostream> using namespace std; void show(int *x) {     cout<<*x<<endl; } int main() {     int age = 20;     show(&age);          return 0; }

Call by value in C++

PRINCIPLES OF PROGRAMMING LANGUAGES PRACT. Write a program in C++ to implement call by  value parameter passing Methods. #include <iostream> using namespace std; void show(int x) {     cout<<x<<endl; } int main() {     int age = 20;     show(age);     show(10);     return 0; }

Implementation of pointers in C++

PRINIPLES OF PROGRAMMING LANGUAGES PRACT. Implementation of pointers in C++. #include <iostream> using namespace std; int main () {    int  age = 20;     int  *a;           a = &age;         cout << “Address of Age variable  “;    cout << a << endl;    cout << “Age = “; […]