Click here to Skip to main content
16,016,460 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi...

This Is My Inheritance Example in this I want to Print MonthSalary and HourlySalary

C#
using System;

public class Employee 
{
     public string  FristName;
    public string LastName;
   public string Email;

    public void FullName()
    {
        Console.WriteLine(FristName+ "  " + LastName+"  "+Email);
      
    }
    public class EmployeeMounthSalary : Employee
    {
       public float MounthSalary;
       
        
    }
    public class EmployeeHourlySalary : Employee
    {
       public float HourlySalary;
    }

    public 

    class Program
    {
        public static void Main()
        {
            EmployeeMounthSalary EMS = new EmployeeMounthSalary();
            EMS.FristName = "Raja";
            EMS.LastName = "Thananki";
            EMS.Email = "traja003@gmail.com";
            EMS.MounthSalary = 1000;
            EMS.FullName();


            EmployeeHourlySalary EHS = new EmployeeHourlySalary();
            EHS.FristName = "Raja";
            EHS.LastName = "Thananki";
            EHS.Email = "traja003@gmail.com";
            EHS.HourlySalary= 1000;
            EHS.FullName();

            Console.ReadLine();

        }
        
    }

}


please Help Me How to Print Both MonthSalary
And HourlySalary


Thank you ....for you'r Time
Posted
Updated 28-Feb-14 5:13am
v2
Comments
Sergey Alexandrovich Kryukov 28-Feb-14 11:08am    
And?..
—SA
Sergey Alexandrovich Kryukov 28-Feb-14 11:21am    
Your post does not say anything. Not a question, nothing. So I would expect that you continue your text with something Said Clearly.
—SA
Sergey Alexandrovich Kryukov 28-Feb-14 11:40am    
What does it mean, "call values"?
If you have them, print them...
—SA
ZurdoDev 28-Feb-14 11:15am    
What's the question?
ZurdoDev 28-Feb-14 11:22am    
You already have code that does Console.WriteLine() right? So, you know how to put it on the console. Where are you stuck?

C#
Console.WriteLine(EHS.MounthSalary);
Console.WriteLine(EHS.HourlySalary);
 
Share this answer
 
What you are asking is very basic programming. I suggest reading this
http://www.dotnetperls.com/console-writeline[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900