Click here to Skip to main content
15,886,012 members
Home / Discussions / C#
   

C#

 
AnswerRe: Insert selected combobox item into database table Pin
NotPolitcallyCorrect6-Feb-17 8:48
NotPolitcallyCorrect6-Feb-17 8:48 
GeneralRe: Insert selected combobox item into database table Pin
rattlerrFx6-Feb-17 8:57
rattlerrFx6-Feb-17 8:57 
AnswerRe: Insert selected combobox item into database table Pin
Richard Deeming6-Feb-17 10:12
mveRichard Deeming6-Feb-17 10:12 
GeneralRe: Insert selected combobox item into database table Pin
rattlerrFx6-Feb-17 16:58
rattlerrFx6-Feb-17 16:58 
GeneralRe: Insert selected combobox item into database table Pin
Richard Deeming7-Feb-17 3:00
mveRichard Deeming7-Feb-17 3:00 
QuestionI am getting error while saving outlook file in folder and when i am opening outlook file i am getting error Pin
Member 126658716-Feb-17 0:13
Member 126658716-Feb-17 0:13 
AnswerRe: I am getting error while saving outlook file in folder and when i am opening outlook file i am getting error Pin
Nathan Minier6-Feb-17 1:35
professionalNathan Minier6-Feb-17 1:35 
QuestionHow to complete the following C# program on Custom datatypes using interface? Pin
Member 129842755-Feb-17 16:08
Member 129842755-Feb-17 16:08 
In the below code snippet, Ring() method defined in Classes "SmartPhone", "BasicPhone" etc is returning a custom datatype called "Sound". As far as I have read few topics, custom datatypes can be implemented using Classes, Structures etc.Normally, I have worked with methods returning in-built datatypes like int,string etc but have no idea about methods returning custom datatypes like "Sound" as per mentioned example. So, how should I write/define the Class "Sound" for the above program to work


OR (an other explanation w.r.t the question asked)

If code execution calls "Phone.Ring()" statement in the foreach loop defined Main() method , let's say a message "MP3 music is playing" for Smartphone, "Polyphonic music is playing" for SemiSmartPhone, "8BitMusic is playing" for BasicPhone to be displayed on the console screen. 
Let me know if you need more details.To be honest, had posted in other forums, but couldn't get an answer yet.As far as I remember, this code example has been picked from codeproject.com I believe.  Thanks


My Program on hold:


class Sound
{
    ???// What should the implementation of this class be for the program    
       //to work
}
interface IRingable
{
    public Sound Ring();
}
class SmartPhone : IRingable
{
    public Sound Ring()
    {
        return PlayMp3Music();

    }

}
class SemiSmartPhone : IRingable
{
    public Sound Ring()
    {
        return PolyPhonicMusic();
    }
}
class BasicPhone : IRingable
{
    public Sound Ring()
    {
        return 8BitMusic();
    }
}

class Main
{
    public static void Main(string[] args)
    {
        List<IRingable> phones = new List<IRingable>();
        IRingable htc = new SmartPhone();
        phones.Add(htc);
        IRingable samsung = new SemiSmartPhone();
        phones.Add(samsung);
        IRingable nokia = new BasicPhone();
        phones.Add(nokia);
        // Lets Ring them all
        foreach (IRingable phone in phones)
        {
            phone.Ring();
        }
    }
}

AnswerRe: How to complete the following C# program on Custom datatypes using interface? Pin
Pete O'Hanlon5-Feb-17 22:13
mvePete O'Hanlon5-Feb-17 22:13 
GeneralRe: How to complete the following C# program on Custom datatypes using interface? Pin
Member 129842756-Feb-17 5:26
Member 129842756-Feb-17 5:26 
AnswerRe: How to complete the following C# program on Custom datatypes using interface? Pin
Richard MacCutchan5-Feb-17 22:17
mveRichard MacCutchan5-Feb-17 22:17 
QuestionC# Winform: How play powerpoint slide inside webbrowser control Pin
Tridip Bhattacharjee5-Feb-17 10:44
professionalTridip Bhattacharjee5-Feb-17 10:44 
AnswerRe: C# Winform: How play powerpoint slide inside webbrowser control Pin
Richard MacCutchan5-Feb-17 22:12
mveRichard MacCutchan5-Feb-17 22:12 
QuestionHow to run ppt slide one after one by Process.Start Pin
Tridip Bhattacharjee5-Feb-17 8:18
professionalTridip Bhattacharjee5-Feb-17 8:18 
AnswerRe: How to run ppt slide one after one by Process.Start Pin
Dave Kreskowiak5-Feb-17 10:05
mveDave Kreskowiak5-Feb-17 10:05 
GeneralRe: How to run ppt slide one after one by Process.Start Pin
Tridip Bhattacharjee5-Feb-17 10:43
professionalTridip Bhattacharjee5-Feb-17 10:43 
GeneralRe: How to run ppt slide one after one by Process.Start Pin
Dave Kreskowiak5-Feb-17 17:52
mveDave Kreskowiak5-Feb-17 17:52 
GeneralRe: How to run ppt slide one after one by Process.Start Pin
Pete O'Hanlon5-Feb-17 21:05
mvePete O'Hanlon5-Feb-17 21:05 
GeneralRe: How to run ppt slide one after one by Process.Start Pin
Tridip Bhattacharjee5-Feb-17 22:51
professionalTridip Bhattacharjee5-Feb-17 22:51 
GeneralRe: How to run ppt slide one after one by Process.Start Pin
Dave Kreskowiak6-Feb-17 3:00
mveDave Kreskowiak6-Feb-17 3:00 
QuestionRegistries in Windows 10 Pro Pin
picasso23-Feb-17 14:40
picasso23-Feb-17 14:40 
AnswerRe: Registries in Windows 10 Pro Pin
Richard MacCutchan3-Feb-17 22:10
mveRichard MacCutchan3-Feb-17 22:10 
QuestionCOM object that has been separated from its underlying RCW cannot be used. Pin
hpjchobbes3-Feb-17 4:48
hpjchobbes3-Feb-17 4:48 
QuestionAccess Network Share with a Microsoft HoloLens Pin
Member 127713943-Feb-17 4:01
Member 127713943-Feb-17 4:01 
QuestionRe: Access Network Share with a Microsoft HoloLens Pin
Richard MacCutchan3-Feb-17 6:42
mveRichard MacCutchan3-Feb-17 6:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.